Exemple #1
0
 // constructors
 /// <summary>
 /// Creates a new instance of MongoClientSettings. Usually you would use a connection string instead.
 /// </summary>
 public MongoClientSettings()
 {
     _connectionMode     = ConnectionMode.Automatic;
     _connectTimeout     = MongoDefaults.ConnectTimeout;
     _credentials        = new MongoCredentialStore(new MongoCredential[0]);
     _guidRepresentation = MongoDefaults.GuidRepresentation;
     _ipv6                  = false;
     _localThreshold        = MongoDefaults.LocalThreshold;
     _maxConnectionIdleTime = MongoDefaults.MaxConnectionIdleTime;
     _maxConnectionLifeTime = MongoDefaults.MaxConnectionLifeTime;
     _maxConnectionPoolSize = MongoDefaults.MaxConnectionPoolSize;
     _minConnectionPoolSize = MongoDefaults.MinConnectionPoolSize;
     _readConcern           = ReadConcern.Default;
     _readEncoding          = null;
     _readPreference        = ReadPreference.Primary;
     _replicaSetName        = null;
     _servers               = new List <MongoServerAddress> {
         new MongoServerAddress("localhost")
     };
     _serverSelectionTimeout = MongoDefaults.ServerSelectionTimeout;
     _socketTimeout          = MongoDefaults.SocketTimeout;
     _sslSettings            = null;
     _useSsl = false;
     _verifySslCertificate = true;
     _waitQueueSize        = MongoDefaults.ComputedWaitQueueSize;
     _waitQueueTimeout     = MongoDefaults.WaitQueueTimeout;
     _writeConcern         = WriteConcern.Acknowledged;
     _writeEncoding        = null;
 }
Exemple #2
0
        // 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;
            _credentials        = new MongoCredentialStore(new MongoCredential[0]);
            _guidRepresentation = MongoDefaults.GuidRepresentation;
            _ipv6 = false;
            _maxConnectionIdleTime      = MongoDefaults.MaxConnectionIdleTime;
            _maxConnectionLifeTime      = MongoDefaults.MaxConnectionLifeTime;
            _maxConnectionPoolSize      = MongoDefaults.MaxConnectionPoolSize;
            _minConnectionPoolSize      = MongoDefaults.MinConnectionPoolSize;
            _readEncoding               = null;
            _readPreference             = ReadPreference.Primary;
            _replicaSetName             = null;
            _secondaryAcceptableLatency = MongoDefaults.SecondaryAcceptableLatency;
            _servers = new List <MongoServerAddress> {
                new MongoServerAddress("localhost")
            };
            _socketTimeout        = MongoDefaults.SocketTimeout;
            _sslSettings          = null;
            _useSsl               = false;
            _verifySslCertificate = true;
            _waitQueueSize        = MongoDefaults.ComputedWaitQueueSize;
            _waitQueueTimeout     = MongoDefaults.WaitQueueTimeout;
#pragma warning disable 612, 618
            _writeConcern = MongoDefaults.SafeMode.WriteConcern;
#pragma warning restore
            _writeEncoding = null;
        }
        // constructors
        public ClusterKey(
            bool allowInsecureTls,
            string applicationName,
            Action <ClusterBuilder> clusterConfigurator,
            IReadOnlyList <CompressorConfiguration> compressors,
            ConnectionMode connectionMode,
            TimeSpan connectTimeout,
            IReadOnlyList <MongoCredential> credentials,
            TimeSpan heartbeatInterval,
            TimeSpan heartbeatTimeout,
            bool ipv6,
            TimeSpan localThreshold,
            TimeSpan maxConnectionIdleTime,
            TimeSpan maxConnectionLifeTime,
            int maxConnectionPoolSize,
            int minConnectionPoolSize,
            int receiveBufferSize,
            string replicaSetName,
            ConnectionStringScheme scheme,
            string sdamLogFilename,
            int sendBufferSize,
            IReadOnlyList <MongoServerAddress> servers,
            TimeSpan serverSelectionTimeout,
            TimeSpan socketTimeout,
            SslSettings sslSettings,
            bool useTls,
            int waitQueueSize,
            TimeSpan waitQueueTimeout)
        {
            _allowInsecureTls    = allowInsecureTls;
            _applicationName     = applicationName;
            _clusterConfigurator = clusterConfigurator;
            _compressors         = compressors;
            _connectionMode      = connectionMode;
            _connectTimeout      = connectTimeout;
            _credentials         = credentials;
            _heartbeatInterval   = heartbeatInterval;
            _heartbeatTimeout    = heartbeatTimeout;
            _ipv6                   = ipv6;
            _localThreshold         = localThreshold;
            _maxConnectionIdleTime  = maxConnectionIdleTime;
            _maxConnectionLifeTime  = maxConnectionLifeTime;
            _maxConnectionPoolSize  = maxConnectionPoolSize;
            _minConnectionPoolSize  = minConnectionPoolSize;
            _receiveBufferSize      = receiveBufferSize;
            _replicaSetName         = replicaSetName;
            _scheme                 = scheme;
            _sdamLogFilename        = sdamLogFilename;
            _sendBufferSize         = sendBufferSize;
            _servers                = servers;
            _serverSelectionTimeout = serverSelectionTimeout;
            _socketTimeout          = socketTimeout;
            _sslSettings            = sslSettings;
            _useTls                 = useTls;
            _waitQueueSize          = waitQueueSize;
            _waitQueueTimeout       = waitQueueTimeout;

            _hashCode = CalculateHashCode();
        }
Exemple #4
0
        // constructors
        public ClusterKey(
            string applicationName,
            Action <ClusterBuilder> clusterConfigurator,
            ConnectionMode connectionMode,
            TimeSpan connectTimeout,
            IReadOnlyList <MongoCredential> credentials,
            TimeSpan heartbeatInterval,
            TimeSpan heartbeatTimeout,
            bool ipv6,
            TimeSpan localThreshold,
            TimeSpan maxConnectionIdleTime,
            TimeSpan maxConnectionLifeTime,
            int maxConnectionPoolSize,
            int minConnectionPoolSize,
            string replicaSetName,
            string sdamLogFilename,
            IReadOnlyList <MongoServerAddress> servers,
            TimeSpan serverSelectionTimeout,
            TimeSpan socketTimeout,
            SslSettings sslSettings,
            bool useSsl,
            bool verifySslCertificate,
            int waitQueueSize,
            TimeSpan waitQueueTimeout)
        {
            _applicationName     = applicationName;
            _clusterConfigurator = clusterConfigurator;
            _connectionMode      = connectionMode;
            _connectTimeout      = connectTimeout;
            _credentials         = credentials;
            _heartbeatInterval   = heartbeatInterval;
            _heartbeatTimeout    = heartbeatTimeout;
            _ipv6                   = ipv6;
            _localThreshold         = localThreshold;
            _maxConnectionIdleTime  = maxConnectionIdleTime;
            _maxConnectionLifeTime  = maxConnectionLifeTime;
            _maxConnectionPoolSize  = maxConnectionPoolSize;
            _minConnectionPoolSize  = minConnectionPoolSize;
            _receiveBufferSize      = __defaultReceiveBufferSize; // TODO: add ReceiveBufferSize to MongoServerSettings?
            _replicaSetName         = replicaSetName;
            _sdamLogFilename        = sdamLogFilename;
            _sendBufferSize         = __defaultSendBufferSize; // TODO: add SendBufferSize to MongoServerSettings?
            _servers                = servers;
            _serverSelectionTimeout = serverSelectionTimeout;
            _socketTimeout          = socketTimeout;
            _sslSettings            = sslSettings;
            _useSsl                 = useSsl;
            _verifySslCertificate   = verifySslCertificate;
            _waitQueueSize          = waitQueueSize;
            _waitQueueTimeout       = waitQueueTimeout;

            _hashCode = CalculateHashCode();
        }
        // constructors
        /// <summary>
        /// Creates a new instance of MongoClientSettings. Usually you would use a connection string instead.
        /// </summary>
        public MongoClientSettings()
        {
            _allowInsecureTls = false;
            _applicationName = null;
            _autoEncryptionOptions = null;
            _compressors = new CompressorConfiguration[0];
#pragma warning disable CS0618 // Type or member is obsolete
            _connectionMode = ConnectionMode.Automatic;
            _connectionModeSwitch = ConnectionModeSwitch.NotSet;
#pragma warning restore CS0618 // Type or member is obsolete
            _connectTimeout = MongoDefaults.ConnectTimeout;
            _credentials = new MongoCredentialStore(new MongoCredential[0]);
            _directConnection = null;
#pragma warning disable 618
            if (BsonDefaults.GuidRepresentationMode == GuidRepresentationMode.V2)
            {
                _guidRepresentation = MongoDefaults.GuidRepresentation;
            }
#pragma warning restore 618
            _heartbeatInterval = ServerSettings.DefaultHeartbeatInterval;
            _heartbeatTimeout = ServerSettings.DefaultHeartbeatTimeout;
            _ipv6 = false;
            _localThreshold = MongoDefaults.LocalThreshold;
            _maxConnectionIdleTime = MongoDefaults.MaxConnectionIdleTime;
            _maxConnectionLifeTime = MongoDefaults.MaxConnectionLifeTime;
            _maxConnectionPoolSize = MongoDefaults.MaxConnectionPoolSize;
            _minConnectionPoolSize = MongoDefaults.MinConnectionPoolSize;
            _readConcern = ReadConcern.Default;
            _readEncoding = null;
            _readPreference = ReadPreference.Primary;
            _replicaSetName = null;
            _retryReads = true;
            _retryWrites = true;
            _scheme = ConnectionStringScheme.MongoDB;
            _sdamLogFilename = null;
            _servers = new List<MongoServerAddress> { new MongoServerAddress("localhost") };
            _serverSelectionTimeout = MongoDefaults.ServerSelectionTimeout;
            _socketTimeout = MongoDefaults.SocketTimeout;
            _sslSettings = null;
            _useTls = false;
#pragma warning disable 618
            _waitQueueSize = MongoDefaults.ComputedWaitQueueSize;
#pragma warning restore 618
            _waitQueueTimeout = MongoDefaults.WaitQueueTimeout;
            _writeConcern = WriteConcern.Acknowledged;
            _writeEncoding = null;
        }
 // constructors
 /// <summary>
 /// Creates a new instance of MongoServerSettings. Usually you would use a connection string instead.
 /// </summary>
 public MongoServerSettings()
 {
     _allowInsecureTls   = false;
     _applicationName    = null;
     _compressors        = new CompressorConfiguration[0];
     _connectionMode     = ConnectionMode.Automatic;
     _connectTimeout     = MongoDefaults.ConnectTimeout;
     _credentials        = new MongoCredentialStore(new MongoCredential[0]);
     _guidRepresentation = MongoDefaults.GuidRepresentation;
     _heartbeatInterval  = ServerSettings.DefaultHeartbeatInterval;
     _heartbeatTimeout   = ServerSettings.DefaultHeartbeatTimeout;
     _ipv6                  = false;
     _localThreshold        = MongoDefaults.LocalThreshold;
     _maxConnectionIdleTime = MongoDefaults.MaxConnectionIdleTime;
     _maxConnectionLifeTime = MongoDefaults.MaxConnectionLifeTime;
     _maxConnectionPoolSize = MongoDefaults.MaxConnectionPoolSize;
     _minConnectionPoolSize = MongoDefaults.MinConnectionPoolSize;
     _operationTimeout      = MongoDefaults.OperationTimeout;
     _readConcern           = ReadConcern.Default;
     _readEncoding          = null;
     _readPreference        = ReadPreference.Primary;
     _replicaSetName        = null;
     _retryReads            = true;
     _retryWrites           = true;
     _scheme                = ConnectionStringScheme.MongoDB;
     _sdamLogFilename       = null;
     _servers               = new List <MongoServerAddress> {
         new MongoServerAddress("localhost")
     };
     _serverSelectionTimeout = MongoDefaults.ServerSelectionTimeout;
     _socketTimeout          = MongoDefaults.SocketTimeout;
     _sslSettings            = null;
     _useTls           = false;
     _waitQueueSize    = MongoDefaults.ComputedWaitQueueSize;
     _waitQueueTimeout = MongoDefaults.WaitQueueTimeout;
     _writeConcern     = WriteConcern.Unacknowledged;
     _writeEncoding    = null;
 }
        // constructors
        public ClusterKey(
            bool allowInsecureTls,
            string applicationName,
            Action <ClusterBuilder> clusterConfigurator,
            IReadOnlyList <CompressorConfiguration> compressors,
#pragma warning disable CS0618 // Type or member is obsolete
            ConnectionMode connectionMode,
            ConnectionModeSwitch connectionModeSwitch,
#pragma warning restore CS0618 // Type or member is obsolete
            TimeSpan connectTimeout,
            IReadOnlyList <MongoCredential> credentials,
            bool?directConnection,
            TimeSpan heartbeatInterval,
            TimeSpan heartbeatTimeout,
            bool ipv6,
            IReadOnlyDictionary <string, IReadOnlyDictionary <string, object> > kmsProviders,
            TimeSpan localThreshold,
            TimeSpan maxConnectionIdleTime,
            TimeSpan maxConnectionLifeTime,
            int maxConnectionPoolSize,
            int minConnectionPoolSize,
            int receiveBufferSize,
            string replicaSetName,
            IReadOnlyDictionary <string, BsonDocument> schemaMap,
            ConnectionStringScheme scheme,
            string sdamLogFilename,
            int sendBufferSize,
            ServerApi serverApi,
            IReadOnlyList <MongoServerAddress> servers,
            TimeSpan serverSelectionTimeout,
            TimeSpan socketTimeout,
            SslSettings sslSettings,
            bool useTls,
            int waitQueueSize,
            TimeSpan waitQueueTimeout)
        {
            ConnectionModeHelper.EnsureConnectionModeValuesAreValid(connectionMode, connectionModeSwitch, directConnection);

            _allowInsecureTls     = allowInsecureTls;
            _applicationName      = applicationName;
            _clusterConfigurator  = clusterConfigurator;
            _compressors          = compressors;
            _connectionMode       = connectionMode;
            _connectionModeSwitch = connectionModeSwitch;
            _connectTimeout       = connectTimeout;
            _credentials          = credentials;
            _directConnection     = directConnection;
            _heartbeatInterval    = heartbeatInterval;
            _heartbeatTimeout     = heartbeatTimeout;
            _ipv6                   = ipv6;
            _kmsProviders           = kmsProviders;
            _localThreshold         = localThreshold;
            _maxConnectionIdleTime  = maxConnectionIdleTime;
            _maxConnectionLifeTime  = maxConnectionLifeTime;
            _maxConnectionPoolSize  = maxConnectionPoolSize;
            _minConnectionPoolSize  = minConnectionPoolSize;
            _receiveBufferSize      = receiveBufferSize;
            _replicaSetName         = replicaSetName;
            _schemaMap              = schemaMap;
            _scheme                 = scheme;
            _sdamLogFilename        = sdamLogFilename;
            _sendBufferSize         = sendBufferSize;
            _serverApi              = serverApi;
            _servers                = servers;
            _serverSelectionTimeout = serverSelectionTimeout;
            _socketTimeout          = socketTimeout;
            _sslSettings            = sslSettings;
            _useTls                 = useTls;
            _waitQueueSize          = waitQueueSize;
            _waitQueueTimeout       = waitQueueTimeout;

            _hashCode = CalculateHashCode();
        }