当前位置: 首页>>代码示例>>C#>>正文


C# Connection.DeleteDatabase方法代码示例

本文整理汇总了C#中Connection.DeleteDatabase方法的典型用法代码示例。如果您正苦于以下问题:C# Connection.DeleteDatabase方法的具体用法?C# Connection.DeleteDatabase怎么用?C# Connection.DeleteDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Connection的用法示例。


在下文中一共展示了Connection.DeleteDatabase方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitDb

        private void InitDb()
        {
            Connection connection = new Connection(new Uri(Config.HOST));

            connection.DeleteDatabase(Config.CLOTHES_DB_NAME);

            //if (!connection.ListDatabases().Any(db => db == Config.CLOTHES_DB_NAME))
            //{
            connection.CreateDatabase(Config.CLOTHES_DB_NAME);

            Session session = connection.CreateSession(Config.CLOTHES_DB_NAME);

            string allClothesScript =
                File.ReadAllText(HttpContext.Current.Server.MapPath("~/App_Data/all-clothes-map.js"));

            string colorsMap =
                File.ReadAllText(HttpContext.Current.Server.MapPath("~/App_Data/colors-map.js"));

            string colorsReduce =
                File.ReadAllText(HttpContext.Current.Server.MapPath("~/App_Data/colors-reduce.js"));

            DesignDocument designDocument = new DesignDocument();
            designDocument.Language = "javascript";
            designDocument.Views = new Dictionary<string, View>();

            designDocument.Views.Add("all-clothes", new View { Map = allClothesScript });
            designDocument.Views.Add("colors-breakdown", new View { Map = colorsMap, Reduce = colorsReduce });

            session.Save(designDocument, "_design/clothes-queries");
            //}
        }
开发者ID:mondok,项目名称:CouchDB-MVC-Sample,代码行数:31,代码来源:Global.asax.cs

示例2: FixtureSetup

        public void FixtureSetup()
        {
            _cx = ConnectionTests.CreateConnection();
            if (_cx.ListDatabases().Contains("relax-query-tests"))
            {
                _cx.DeleteDatabase("relax-query-tests");
            }
            _cx.CreateDatabase("relax-query-tests");
            _sx = _cx.CreateSession("relax-query-tests");
        
            // populate a few widgets & a simple design doc
            _sx.Save(new Widget { Name = "widget", Manufacturer = "acme" });
            _sx.Save(new Widget { Name = "sprocket", Manufacturer = "acme" });
            _sx.Save(new Widget { Name = "doodad", Manufacturer = "widgetco" });

            _sx.Save(
                new DesignDocument {
                         Language = "javascript",
                         Views = new Dictionary<string, View>
                         {
                            { "all-widgets", new View {
                                Map = @"function(doc) { emit(null, null); }"
                            }},
                            { "all-manufacturers", new View() {
                                Map = @"function(doc) { emit(doc.Manufacturer, 1); }",
                                Reduce = @"function(keys, values, rereduce) { return sum(values); }"
                            }}
                         }
                 },
                 "_design/widgets"
            );      
        }
开发者ID:nicknystrom,项目名称:RedBranch.Hammock,代码行数:32,代码来源:QueryTests.cs

示例3: FixtureSetup

        public void FixtureSetup()
        {
            _cx = ConnectionTests.CreateConnection();
            if (_cx.ListDatabases().Contains("relax-reference-tests"))
            {
                _cx.DeleteDatabase("relax-reference-tests");
            }
            _cx.CreateDatabase("relax-reference-tests");
            _sx = _cx.CreateSession("relax-reference-tests");
            _sx2 = _cx.CreateSession("relax-reference-tests");

            _sx.Save(new Widget { Id = "w1", Name = "Widget", Cost = 30 });
            _sx.Save(new Widget { Id = "w2", Name = "Gadget", Cost = 30 });
            _sx.Save(new Widget { Id = "w3", Name = "Foo",    Cost = 35 });
            _sx.Save(new Widget { Id = "w4", Name = "Bar",    Cost = 35 });
            _sx.Save(new Widget { Id = "w5", Name = "Biz",    Cost = 45 });
            _sx.Save(new Widget { Id = "w6", Name = "Bang",   Cost = 55 });
            
            _sx.SaveRaw(JObject.Parse(
            @"{
                _id: 'g1',
                Name: 'Gadget #1',
                Primary: 'w1'
            }"));
            
            _sx.SaveRaw(JObject.Parse(
            @"{
                _id: 'g2',
                Name: 'Gadget #1',
                Secondary: ['w1', 'w2', 'w3']
            }"));

        }
开发者ID:nicknystrom,项目名称:RedBranch.Hammock,代码行数:33,代码来源:ReferenceTests.cs

示例4: FixtureSetup

 public void FixtureSetup()
 {
     _cx = ConnectionTests.CreateConnection();
     if (_cx.ListDatabases().Contains("relax-observer-tests"))
     {
         _cx.DeleteDatabase("relax-observer-tests");
     }
     _cx.CreateDatabase("relax-observer-tests");
 }
开发者ID:nicknystrom,项目名称:RedBranch.Hammock,代码行数:9,代码来源:ObserverTests.cs

示例5: FixtureSetup

        public void FixtureSetup()
        {
            _cx = ConnectionTests.CreateConnection();
            if (_cx.ListDatabases().Contains("relax-session-tests"))
            {
                _cx.DeleteDatabase("relax-session-tests");
            }
            _cx.CreateDatabase("relax-session-tests");
            _sx = _cx.CreateSession("relax-session-tests");

            // create an initial document on a seperate session
            var x = _cx.CreateSession(_sx.Database);
            var w = new Widget {Name = "gizmo", Tags = new[] {"whizbang", "geegollie"}};
            _doc = x.Save(w);
        }
开发者ID:nicknystrom,项目名称:RedBranch.Hammock,代码行数:15,代码来源:SessionTests.cs


注:本文中的Connection.DeleteDatabase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。