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


C# MongoClient.DropDatabaseAsync方法代码示例

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


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

示例1: DropDatabaseAsync_should_invoke_the_correct_operation

        public async Task DropDatabaseAsync_should_invoke_the_correct_operation()
        {
            var operationExecutor = new MockOperationExecutor();
            var client = new MongoClient(operationExecutor);
            await client.DropDatabaseAsync("awesome");

            var call = operationExecutor.GetWriteCall<BsonDocument>();

            call.Operation.Should().BeOfType<DropDatabaseOperation>();
            ((DropDatabaseOperation)call.Operation).DatabaseNamespace.Should().Be(new DatabaseNamespace("awesome"));
        }
开发者ID:fir3pho3nixx,项目名称:mongo-csharp-driver,代码行数:11,代码来源:MongoClientTests.cs

示例2: DropDatabase_should_invoke_the_correct_operation

        public void DropDatabase_should_invoke_the_correct_operation(
            [Values(false, true)] bool async)
        {
            var operationExecutor = new MockOperationExecutor();
            var client = new MongoClient(operationExecutor);

            if (async)
            {
                client.DropDatabaseAsync("awesome").GetAwaiter().GetResult();
            }
            else
            {
                client.DropDatabase("awesome");
            }

            var call = operationExecutor.GetWriteCall<BsonDocument>();

            call.Operation.Should().BeOfType<DropDatabaseOperation>();
            ((DropDatabaseOperation)call.Operation).DatabaseNamespace.Should().Be(new DatabaseNamespace("awesome"));
        }
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:20,代码来源:MongoClientTests.cs

示例3: DropDatabase_should_invoke_the_correct_operation

        public void DropDatabase_should_invoke_the_correct_operation(
            [Values(false, true)] bool async)
        {
            var operationExecutor = new MockOperationExecutor();
            var writeConcern = new WriteConcern(1);
            var client = new MongoClient(operationExecutor, new MongoClientSettings()).WithWriteConcern(writeConcern);

            if (async)
            {
                client.DropDatabaseAsync("awesome").GetAwaiter().GetResult();
            }
            else
            {
                client.DropDatabase("awesome");
            }

            var call = operationExecutor.GetWriteCall<BsonDocument>();

            var dropDatabaseOperation = call.Operation.Should().BeOfType<DropDatabaseOperation>().Subject;
            dropDatabaseOperation.DatabaseNamespace.Should().Be(new DatabaseNamespace("awesome"));
            dropDatabaseOperation.WriteConcern.Should().BeSameAs(writeConcern);
        }
开发者ID:mfidemraizer,项目名称:mongo-csharp-driver,代码行数:22,代码来源:MongoClientTests.cs

示例4: DropDatabase

 public static void DropDatabase()
 {
     var client = new MongoClient(ConnectionString);
     client.DropDatabaseAsync(DatabaseName).Wait();
 }
开发者ID:AppSpaceIT,项目名称:RedCapped,代码行数:5,代码来源:MongoDbUtils.cs

示例5: Clean

 public static void Clean()
 {
     var client = new MongoClient();
      client.DropDatabaseAsync(settings.DatabaseName);
 }
开发者ID:baozkan,项目名称:Tiktak,代码行数:5,代码来源:MongoContextTest.cs

示例6: TestCleanup

 public void TestCleanup()
 {
     var mongoClient = new MongoClient();
     mongoClient.DropDatabaseAsync(DatabaseName).Wait();
 }
开发者ID:akurin,项目名称:EventStorePrototype,代码行数:5,代码来源:AppendBenchmark.cs

示例7: DropDatabase

 protected static void DropDatabase()
 {
     var mongoClient = new MongoClient();
     mongoClient.DropDatabaseAsync(DatabaseName).Wait();
 }
开发者ID:akurin,项目名称:EventStorePrototype,代码行数:5,代码来源:MongoEventStoreSpecification.cs


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