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


C# Driver.SafeMode类代码示例

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


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

示例1: MongoInsertOptions

 /// <summary>
 /// Initializes a new instance of the MongoInsertOptions class.
 /// </summary>
 /// <param name="collection">The collection from which to get default settings for the options.</param>
 public MongoInsertOptions(
     MongoCollection collection
 ) {
     this.checkElementNames = true;
     this.flags = InsertFlags.None;
     this.safeMode = collection.Settings.SafeMode;
 }
开发者ID:snedzad,项目名称:mongo-csharp-driver,代码行数:11,代码来源:MongoInsertOptions.cs

示例2: MongoServerSettings

 public MongoServerSettings(
     ConnectionMode connectionMode,
     TimeSpan connectTimeout,
     MongoCredentials defaultCredentials,
     TimeSpan maxConnectionIdleTime,
     TimeSpan maxConnectionLifeTime,
     int maxConnectionPoolSize,
     int minConnectionPoolSize,
     string replicaSetName,
     SafeMode safeMode,
     IEnumerable<MongoServerAddress> servers,
     bool slaveOk,
     TimeSpan socketTimeout,
     int waitQueueSize,
     TimeSpan waitQueueTimeout
 )
 {
     this.connectionMode = connectionMode;
     this.connectTimeout = connectTimeout;
     this.defaultCredentials = defaultCredentials;
     this.maxConnectionIdleTime = maxConnectionIdleTime;
     this.maxConnectionLifeTime = maxConnectionLifeTime;
     this.maxConnectionPoolSize = maxConnectionPoolSize;
     this.minConnectionPoolSize = minConnectionPoolSize;
     this.replicaSetName = replicaSetName;
     this.safeMode = safeMode;
     this.servers = servers;
     this.slaveOk = slaveOk;
     this.socketTimeout = socketTimeout;
     this.waitQueueSize = waitQueueSize;
     this.waitQueueTimeout = waitQueueTimeout;
 }
开发者ID:Teun,项目名称:mongo-csharp-driver,代码行数:32,代码来源:MongoServerSettings.cs

示例3: MongoDatabaseSettings

 public MongoDatabaseSettings()
 {
     this.databaseName = null;
     this.credentials = null;
     this.safeMode = SafeMode.False;
     this.slaveOk = false;
 }
开发者ID:modesto,项目名称:mongo-csharp-driver,代码行数:7,代码来源:MongoDatabaseSettings.cs

示例4: 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="safeMode">The safe mode to use.</param>
        public MongoDatabaseSettings(
            string databaseName,
            MongoCredentials credentials,
            GuidRepresentation guidRepresentation,
            ReadPreference readPreference,
            SafeMode safeMode)
        {
            if (databaseName == null)
            {
                throw new ArgumentNullException("databaseName");
            }
            if (databaseName == "admin" && credentials != null && !credentials.Admin)
            {
                throw new ArgumentOutOfRangeException("Credentials for the admin database must have the admin flag set to true.");
            }
            if (readPreference == null)
            {
                throw new ArgumentNullException("readPreference");
            }
            if (safeMode == null)
            {
                throw new ArgumentNullException("safeMode");
            }

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

示例5: 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="safeMode">The safe mode to use.</param>
 /// <param name="slaveOk">Whether queries should be sent to secondary servers.</param>
 public MongoDatabaseSettings(string databaseName, MongoCredentials credentials, GuidRepresentation guidRepresentation, SafeMode safeMode, bool slaveOk)
 {
     _databaseName = databaseName;
     _credentials = credentials;
     _guidRepresentation = guidRepresentation;
     _safeMode = safeMode;
     _slaveOk = slaveOk;
 }
开发者ID:moonreplace,项目名称:mongo-csharp-driver,代码行数:16,代码来源:MongoDatabaseSettings.cs

示例6: 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="safeMode">The safe mode to use.</param>
 /// <param name="slaveOk">Whether queries should be sent to secondary servers.</param>
 public MongoDatabaseSettings(string databaseName, MongoCredentials credentials, GuidRepresentation guidRepresentation, SafeMode safeMode, ReadPreference readPreference)
 {
     this.databaseName = databaseName;
     this.credentials = credentials;
     this.guidRepresentation = guidRepresentation;
     this.safeMode = safeMode;
     this.readPreference = readPreference;
 }
开发者ID:kamaradclimber,项目名称:mongo-csharp-driver,代码行数:16,代码来源:MongoDatabaseSettings.cs

示例7: MongoCollectionSettings

 public MongoCollectionSettings()
 {
     this.collectionName = null;
     this.assignIdOnInsert = true;
     this.defaultDocumentType = typeof(BsonDocument);
     this.safeMode = SafeMode.False;
     this.slaveOk = false;
 }
开发者ID:modesto,项目名称:mongo-csharp-driver,代码行数:8,代码来源:MongoCollectionSettings.cs

示例8: MongoDatabaseSettings

 // constructors
 /// <summary>
 /// Creates a new instance of MongoDatabaseSettings.
 /// </summary>
 /// <param name="server">The server to inherit settings from.</param>
 /// <param name="databaseName">The name of the database.</param>
 public MongoDatabaseSettings(MongoServer server, string databaseName)
 {
     var serverSettings = server.Settings;
     _databaseName = databaseName;
     _credentials = serverSettings.DefaultCredentials;
     _guidRepresentation = serverSettings.GuidRepresentation;
     _safeMode = serverSettings.SafeMode;
     _slaveOk = serverSettings.SlaveOk;
 }
开发者ID:purplecow,项目名称:mongo-csharp-driver,代码行数:15,代码来源:MongoDatabaseSettings.cs

示例9: MongoCollectionSettings

 // constructors
 /// <summary>
 /// Initializes a new instance of the MongoCollectionSettings class.
 /// </summary>
 /// <param name="database">The database that contains the collection (some collection settings will be inherited from the database settings).</param>
 /// <param name="collectionName">The name of the collection.</param>
 /// <param name="defaultDocumentType">The default document type for the collection.</param>
 protected MongoCollectionSettings(MongoDatabase database, string collectionName, Type defaultDocumentType)
 {
     var databaseSettings = database.Settings;
     _collectionName = collectionName;
     _assignIdOnInsert = MongoDefaults.AssignIdOnInsert;
     _defaultDocumentType = defaultDocumentType;
     _guidRepresentation = databaseSettings.GuidRepresentation;
     _safeMode = databaseSettings.SafeMode;
     _slaveOk = databaseSettings.SlaveOk;
 }
开发者ID:abel,项目名称:sinan,代码行数:17,代码来源:MongoCollectionSettings.cs

示例10: TestCreateWithEnabledAndFSync

 public void TestCreateWithEnabledAndFSync()
 {
     var safeMode = new SafeMode(true, true);
     Assert.AreEqual(true, safeMode.Enabled);
     Assert.AreEqual(true, safeMode.FSync);
     Assert.AreEqual(false, safeMode.Journal);
     Assert.AreEqual(0, safeMode.W);
     Assert.AreEqual(null, safeMode.WMode);
     Assert.AreEqual(TimeSpan.Zero, safeMode.WTimeout);
 }
开发者ID:Bogdan0x400,项目名称:mongo-csharp-driver,代码行数:10,代码来源:SafeModeTests.cs

示例11: TestCreateWithW

 public void TestCreateWithW()
 {
     var safeMode = new SafeMode(2);
     Assert.AreEqual(true, safeMode.Enabled);
     Assert.AreEqual(false, safeMode.FSync);
     Assert.AreEqual(false, safeMode.J);
     Assert.AreEqual(2, safeMode.W);
     Assert.AreEqual(null, safeMode.WMode);
     Assert.AreEqual(TimeSpan.Zero, safeMode.WTimeout);
 }
开发者ID:ncipollina,项目名称:mongo-csharp-driver,代码行数:10,代码来源:SafeModeTests.cs

示例12: TestCreateWithEnabledAndFSyncAndWAndWTimeout

 public void TestCreateWithEnabledAndFSyncAndWAndWTimeout()
 {
     var safeMode = new SafeMode(true, true, 2, TimeSpan.FromSeconds(30));
     Assert.AreEqual(true, safeMode.Enabled);
     Assert.AreEqual(true, safeMode.FSync);
     Assert.AreEqual(false, safeMode.J);
     Assert.AreEqual(2, safeMode.W);
     Assert.AreEqual(null, safeMode.WMode);
     Assert.AreEqual(TimeSpan.FromSeconds(30), safeMode.WTimeout);
 }
开发者ID:ncipollina,项目名称:mongo-csharp-driver,代码行数:10,代码来源:SafeModeTests.cs

示例13: MongoDatabaseSettings

 /// <summary>
 /// Creates a new instance of MongoDatabaseSettings. Usually you would call MongoServer.CreateDatabaseSettings instead.
 /// </summary>
 /// <param name="databaseName">The name of the database.</param>
 /// <param name="credentials">The credentials to access the database.</param>
 /// <param name="safeMode">The safe mode to use.</param>
 /// <param name="slaveOk">Whether queries should be sent to secondary servers.</param>
 public MongoDatabaseSettings(
     string databaseName,
     MongoCredentials credentials,
     SafeMode safeMode,
     bool slaveOk
 ) {
     this.databaseName = databaseName;
     this.credentials = credentials;
     this.safeMode = safeMode;
     this.slaveOk = slaveOk;
 }
开发者ID:ebix,项目名称:mongo-csharp-driver,代码行数:18,代码来源:MongoDatabaseSettings.cs

示例14: MongoDatabaseSettings

 /// <summary>
 /// Creates a new instance of MongoDatabaseSettings. Usually you would call MongoServer.CreateDatabaseSettings instead.
 /// </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="safeMode">The safe mode to use.</param>
 /// <param name="slaveOk">Whether queries should be sent to secondary servers.</param>
 public MongoDatabaseSettings(
     string databaseName,
     MongoCredentials credentials,
     GuidRepresentation guidRepresentation,
     SafeMode safeMode,
     bool slaveOk
 ) {
     this.databaseName = databaseName;
     this.credentials = credentials;
     this.guidRepresentation = guidRepresentation;
     this.safeMode = safeMode;
     this.slaveOk = slaveOk;
 }
开发者ID:redforks,项目名称:mongo-csharp-driver,代码行数:21,代码来源:MongoDatabaseSettings.cs

示例15: MongoCollectionSettings

 protected MongoCollectionSettings(
     string collectionName,
     bool assignIdOnInsert,
     Type defaultDocumentType,
     SafeMode safeMode,
     bool slaveOk
 ) {
     this.collectionName = collectionName;
     this.assignIdOnInsert = assignIdOnInsert;
     this.defaultDocumentType = defaultDocumentType;
     this.safeMode = safeMode;
     this.slaveOk = slaveOk;
 }
开发者ID:ebix,项目名称:mongo-csharp-driver,代码行数:13,代码来源:MongoCollectionSettings.cs


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