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


C# WriteConcern类代码示例

本文整理汇总了C#中WriteConcern的典型用法代码示例。如果您正苦于以下问题:C# WriteConcern类的具体用法?C# WriteConcern怎么用?C# WriteConcern使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: BulkDeleteOperationArgs

 // constructors
 public BulkDeleteOperationArgs(
     string collectionName,
     string databaseName,
     int maxBatchCount,
     int maxBatchLength,
     int maxDocumentSize,
     int maxWireDocumentSize,
     bool isOrdered,
     BsonBinaryReaderSettings readerSettings,
     IEnumerable<DeleteRequest> requests,
     WriteConcern writeConcern,
     BsonBinaryWriterSettings writerSettings)
     : base(
         collectionName,
         databaseName,
         maxBatchCount,
         maxBatchLength,
         maxDocumentSize,
         maxWireDocumentSize,
         isOrdered,
         readerSettings,
         requests.Cast<WriteRequest>(),
         writeConcern,
         writerSettings)
 {
 }
开发者ID:ExM,项目名称:mongo-csharp-driver,代码行数:27,代码来源:BulkDeleteOperationArgs.cs

示例2: MongoDatabaseSettings

        /// <summary>
        /// Creates a new instance of MongoDatabaseSettings.
        /// </summary>
        /// <param name="databaseName">The name of the database.</param>
        /// <param name="credentials">The credentials to access the database.</param>
        /// <param name="guidRepresentation">The representation for Guids.</param>
        /// <param name="readPreference">The read preference.</param>
        /// <param name="writeConcern">The write concern to use.</param>
        public MongoDatabaseSettings(
            string databaseName,
            MongoCredentials credentials,
            GuidRepresentation guidRepresentation,
            ReadPreference readPreference,
            WriteConcern writeConcern)
        {
            if (databaseName == null)
            {
                throw new ArgumentNullException("databaseName");
            }
            if (databaseName == "admin" && credentials != null && !credentials.Admin)
            {
                throw new ArgumentOutOfRangeException("credentials", "Credentials for the admin database must have the admin flag set to true.");
            }
            if (readPreference == null)
            {
                throw new ArgumentNullException("readPreference");
            }
            if (writeConcern == null)
            {
                throw new ArgumentNullException("writeConcern");
            }

            _databaseName = databaseName;
            _credentials = credentials;
            _guidRepresentation = guidRepresentation;
            _readPreference = readPreference;
            _writeConcern = writeConcern;
        }
开发者ID:staywellandy,项目名称:mongo-csharp-driver,代码行数:38,代码来源:MongoDatabaseSettings.cs

示例3: MongoImpl

		public MongoImpl(MongoServer connection, WriteConcern writeConcern)
		{
			this.writeConcern = writeConcern;
			Helpers.Random.Value.NextBytes(initialValue);
			collection =
				connection.GetDatabase(typeof (SomeDocument).Name).GetCollection<SomeDocument>(typeof (SomeDocument).Name);
		}
开发者ID:undeadcat,项目名称:mongobenchmark,代码行数:7,代码来源:MongoImpl.cs

示例4: BulkMixedWriteOperation

 // constructors
 public BulkMixedWriteOperation(
     Action<InsertRequest> assignId,
     bool checkElementNames,
     string collectionName,
     string databaseName,
     int maxBatchCount,
     int maxBatchLength,
     int maxDocumentSize,
     int maxWireDocumentSize,
     bool isOrdered,
     BsonBinaryReaderSettings readerSettings,
     IEnumerable<WriteRequest> requests,
     WriteConcern writeConcern,
     BsonBinaryWriterSettings writerSettings)
 {
     _assignId = assignId;
     _checkElementNames = checkElementNames;
     _collectionName = collectionName;
     _databaseName = databaseName;
     _maxBatchCount = maxBatchCount;
     _maxBatchLength = maxBatchLength;
     _maxDocumentSize = maxDocumentSize;
     _maxWireDocumentSize = maxWireDocumentSize;
     _isOrdered = isOrdered;
     _readerSettings = readerSettings;
     _requests = requests;
     _writeConcern = writeConcern;
     _writerSettings = writerSettings;
 }
开发者ID:niemyjski,项目名称:mongo-csharp-driver,代码行数:30,代码来源:BulkMixedWriteOperation.cs

示例5: GridFSBucketOptions

 /// <summary>
 /// Initializes a new instance of the <see cref="GridFSBucketOptions"/> class.
 /// </summary>
 /// <param name="other">The other <see cref="GridFSBucketOptions.Immutable"/> from which to copy the values.</param>
 public GridFSBucketOptions(GridFSBucketOptions.Immutable other)
 {
     _bucketName = other.BucketName;
     _chunkSizeBytes = other.ChunkSizeBytes;
     _readPreference = other.ReadPreference;
     _writeConcern = other.WriteConcern;
 }
开发者ID:rtfmpliz,项目名称:mongo-csharp-driver,代码行数:11,代码来源:GridFSBucketOptions.cs

示例6: MongoServerSettings

        // constructors
        /// <summary>
        /// Creates a new instance of MongoServerSettings. Usually you would use a connection string instead.
        /// </summary>
        public MongoServerSettings()
        {
            _connectionMode = ConnectionMode.Automatic;
            _connectTimeout = MongoDefaults.ConnectTimeout;
            _credentialsStore = new MongoCredentialsStore();
            _defaultCredentials = null;
            _guidRepresentation = MongoDefaults.GuidRepresentation;
            _ipv6 = false;
            _maxConnectionIdleTime = MongoDefaults.MaxConnectionIdleTime;
            _maxConnectionLifeTime = MongoDefaults.MaxConnectionLifeTime;
            _maxConnectionPoolSize = MongoDefaults.MaxConnectionPoolSize;
            _minConnectionPoolSize = MongoDefaults.MinConnectionPoolSize;
            _readPreference = ReadPreference.Primary;
            _replicaSetName = null;
            _secondaryAcceptableLatency = MongoDefaults.SecondaryAcceptableLatency;
            _servers = new List<MongoServerAddress> { new MongoServerAddress("localhost") };
            _socketTimeout = MongoDefaults.SocketTimeout;
            _useSsl = false;
            _verifySslCertificate = true;
            _waitQueueSize = MongoDefaults.ComputedWaitQueueSize;
            _waitQueueTimeout = MongoDefaults.WaitQueueTimeout;
#pragma warning disable 612, 618
            _writeConcern = MongoDefaults.SafeMode.WriteConcern;
#pragma warning restore
        }
开发者ID:tkellogg,项目名称:mongo-csharp-driver,代码行数:29,代码来源:MongoServerSettings.cs

示例7: BulkWriteOperationArgs

 // constructors
 protected BulkWriteOperationArgs(
     string collectionName,
     string databaseName,
     int maxBatchCount,
     int maxBatchLength,
     int maxDocumentSize,
     int maxWireDocumentSize,
     bool isOrdered,
     BsonBinaryReaderSettings readerSettings,
     IEnumerable<WriteRequest> requests,
     WriteConcern writeConcern,
     BsonBinaryWriterSettings writerSettings)
 {
     _collectionName = collectionName;
     _databaseName = databaseName;
     _maxBatchCount = maxBatchCount;
     _maxBatchLength = maxBatchLength;
     _maxDocumentSize = maxDocumentSize;
     _maxWireDocumentSize = maxWireDocumentSize;
     _isOrdered = isOrdered;
     _readerSettings = readerSettings;
     _requests = requests;
     _writeConcern = writeConcern;
     _writerSettings = writerSettings;
 }
开发者ID:niemyjski,项目名称:mongo-csharp-driver,代码行数:26,代码来源:BulkWriteOperationArgs.cs

示例8: CreateOperation_should_return_expected_result

        public void CreateOperation_should_return_expected_result(
            [Values(false, true)]
            bool isCommandSupported)
        {
            var requests = new[] { new CreateIndexRequest(new BsonDocument("x", 1)) };
            var writeConcern = new WriteConcern(1);
            var subject = new CreateIndexesOperation(_collectionNamespace, requests, _messageEncoderSettings)
            {
                WriteConcern = writeConcern
            };
            var serverVersion = Feature.CreateIndexesCommand.SupportedOrNotSupportedVersion(isCommandSupported);

            var result = subject.CreateOperation(serverVersion);

            if (isCommandSupported)
            {
                result.Should().BeOfType<CreateIndexesUsingCommandOperation>();
                var operation = (CreateIndexesUsingCommandOperation)result;
                operation.CollectionNamespace.Should().BeSameAs(_collectionNamespace);
                operation.MessageEncoderSettings.Should().BeSameAs(_messageEncoderSettings);
                operation.Requests.Should().Equal(requests);
                operation.WriteConcern.Should().BeSameAs(writeConcern);
            }
            else
            {
                result.Should().BeOfType<CreateIndexesUsingInsertOperation>();
                var operation = (CreateIndexesUsingInsertOperation)result;
                operation.CollectionNamespace.Should().BeSameAs(_collectionNamespace);
                operation.MessageEncoderSettings.Should().BeSameAs(_messageEncoderSettings);
                operation.Requests.Should().Equal(requests);
            }
        }
开发者ID:mfidemraizer,项目名称:mongo-csharp-driver,代码行数:32,代码来源:CreateIndexesOperationTests.cs

示例9: BulkInsertOperationArgs

 // constructors
 public BulkInsertOperationArgs(
     Action<InsertRequest> assignId,
     bool checkElementNames,
     string collectionName,
     string databaseName,
     int maxBatchCount,
     int maxBatchLength,
     int maxDocumentSize,
     int maxWireDocumentSize,
     bool isOrdered,
     BsonBinaryReaderSettings readerSettings,
     IEnumerable<InsertRequest> requests,
     WriteConcern writeConcern,
     BsonBinaryWriterSettings writerSettings)
     : base(
         collectionName,
         databaseName,
         maxBatchCount,
         maxBatchLength,
         maxDocumentSize,
         maxWireDocumentSize,
         isOrdered,
         readerSettings,
         requests.Cast<WriteRequest>(),
         writeConcern,
         writerSettings)
 {
     _assignId = assignId;
     _checkElementNames = checkElementNames;
 }
开发者ID:nsavga,项目名称:mongo-csharp-driver,代码行数:31,代码来源:BulkInsertOperationArgs.cs

示例10: Impl

		public Impl(MongoServer connection, WriteConcern writeConcern)
		{
			_writeConcern = writeConcern;
			new Random(BitConverter.ToInt32(Guid.NewGuid().ToByteArray().Take(4).ToArray(), 0)).NextBytes(_initialValue);
			_collection =
				connection.GetDatabase(typeof (SomeDocument).Name).GetCollection<SomeDocument>(typeof (SomeDocument).Name);
		}
开发者ID:undeadcat,项目名称:mongobenchmark,代码行数:7,代码来源:Impl.cs

示例11: Constructor_with_string_argument_should_properly_initialize_instance

 public void Constructor_with_string_argument_should_properly_initialize_instance()
 {
     var writeConcern = new WriteConcern("mode");
     writeConcern.FSync.Should().NotHaveValue();
     writeConcern.Journal.Should().NotHaveValue();
     writeConcern.W.Should().Be((WriteConcern.WValue)"mode");
     writeConcern.WTimeout.Should().NotHaveValue();
 }
开发者ID:Nakro,项目名称:mongo-csharp-driver,代码行数:8,代码来源:WriteConcernTests.cs

示例12: Constructor_with_no_arguments_should_properly_initialize_instance

 public void Constructor_with_no_arguments_should_properly_initialize_instance()
 {
     var writeConcern = new WriteConcern();
     writeConcern.FSync.Should().NotHaveValue();
     writeConcern.Journal.Should().NotHaveValue();
     writeConcern.W.Should().BeNull();
     writeConcern.WTimeout.Should().NotHaveValue();
 }
开发者ID:Nakro,项目名称:mongo-csharp-driver,代码行数:8,代码来源:WriteConcernTests.cs

示例13: GridFSBucketOptions

 /// <summary>
 /// Initializes a new instance of the <see cref="GridFSBucketOptions"/> class.
 /// </summary>
 /// <param name="other">The other <see cref="ImmutableGridFSBucketOptions"/> from which to copy the values.</param>
 public GridFSBucketOptions(ImmutableGridFSBucketOptions other)
 {
     Ensure.IsNotNull(other, nameof(other));
     _bucketName = other.BucketName;
     _chunkSizeBytes = other.ChunkSizeBytes;
     _readConcern = other.ReadConcern;
     _readPreference = other.ReadPreference;
     _writeConcern = other.WriteConcern;
 }
开发者ID:mfidemraizer,项目名称:mongo-csharp-driver,代码行数:13,代码来源:GridFSBucketOptions.cs

示例14: Save

        public override WriteConcernResult Save(BsonDocument document, WriteConcern writeConcern, bool needResult)
        {
            // copy, make id, override
            document = CloneExternalDocument(document);
            var id = document.EnsureId();
            bool updatedExisting = _data.ContainsKey(id);
            _data[id] = document;

            return needResult ? new WriteConcernResult(NewResponse(1, updatedExisting, null, null)) : null;
        }
开发者ID:nightroman,项目名称:Mdbc,代码行数:10,代码来源:NormalFileCollection.cs

示例15: Constructor_with_four_arguments_should_properly_initialize_instance

 public void Constructor_with_four_arguments_should_properly_initialize_instance(int? w, int? wTimeoutSeconds, bool? fsync, bool? journal)
 {
     var wCount = w.HasValue ? (WriteConcern.WValue)w.Value : null;
     var wTimeout = wTimeoutSeconds.HasValue ? (TimeSpan?)TimeSpan.FromSeconds(wTimeoutSeconds.Value) : null;
     var writeConcern = new WriteConcern(wCount, wTimeout, fsync, journal);
     writeConcern.W.Should().Be(wCount);
     writeConcern.WTimeout.Should().Be(wTimeout);
     writeConcern.FSync.Should().Be(fsync);
     writeConcern.Journal.Should().Be(journal);
 }
开发者ID:Nakro,项目名称:mongo-csharp-driver,代码行数:10,代码来源:WriteConcernTests.cs


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