Beispiel #1
0
        /// <summary>
        /// Gets the hash code.
        /// </summary>
        /// <returns>The hash code.</returns>
        public override int GetHashCode()
        {
            if (_isFrozen)
            {
                return(_frozenHashCode);
            }

            // see Effective Java by Joshua Bloch
            int hash = 17;

            hash = 37 * hash + _connectionMode.GetHashCode();
            hash = 37 * hash + _connectTimeout.GetHashCode();
            hash = 37 * hash + _credentialsStore.GetHashCode();
            hash = 37 * hash + (_defaultCredentials == null ? 0 : _defaultCredentials.GetHashCode());
            hash = 37 * hash + _guidRepresentation.GetHashCode();
            hash = 37 * hash + _ipv6.GetHashCode();
            hash = 37 * hash + _maxConnectionIdleTime.GetHashCode();
            hash = 37 * hash + _maxConnectionLifeTime.GetHashCode();
            hash = 37 * hash + _maxConnectionPoolSize.GetHashCode();
            hash = 37 * hash + _minConnectionPoolSize.GetHashCode();
            hash = 37 * hash + (_replicaSetName == null ? 0 : _replicaSetName.GetHashCode());
            hash = 37 * hash + (_safeMode == null ? 0 : _safeMode.GetHashCode());
            if (_servers != null)
            {
                foreach (var server in _servers)
                {
                    hash = 37 * hash + server.GetHashCode();
                }
            }
            hash = 37 * hash + _slaveOk.GetHashCode();
            hash = 37 * hash + _socketTimeout.GetHashCode();
            hash = 37 * hash + _waitQueueSize.GetHashCode();
            hash = 37 * hash + _waitQueueTimeout.GetHashCode();
            return(hash);
        }
        /// <summary>
        /// Gets the hash code.
        /// </summary>
        /// <returns>The hash code.</returns>
        public override int GetHashCode()
        {
            if (_isFrozen)
            {
                return(_frozenHashCode);
            }

            // see Effective Java by Joshua Bloch
            int hash = 17;

            hash = 37 * hash + _connectionMode.GetHashCode();
            hash = 37 * hash + _connectTimeout.GetHashCode();
            hash = 37 * hash + _credentialsStore.GetHashCode();
            hash = 37 * hash + ((_defaultCredentials == null) ? 0 : _defaultCredentials.GetHashCode());
            hash = 37 * hash + _guidRepresentation.GetHashCode();
            hash = 37 * hash + _ipv6.GetHashCode();
            hash = 37 * hash + _maxConnectionIdleTime.GetHashCode();
            hash = 37 * hash + _maxConnectionLifeTime.GetHashCode();
            hash = 37 * hash + _maxConnectionPoolSize.GetHashCode();
            hash = 37 * hash + _minConnectionPoolSize.GetHashCode();
            hash = 37 * hash + _readPreference.GetHashCode();
            hash = 37 * hash + ((_replicaSetName == null) ? 0 : _replicaSetName.GetHashCode());
            hash = 37 * hash + _secondaryAcceptableLatency.GetHashCode();
            foreach (var server in _servers)
            {
                hash = 37 * hash + server.GetHashCode();
            }
            hash = 37 * hash + _socketTimeout.GetHashCode();
            hash = 37 * hash + _useSsl.GetHashCode();
            hash = 37 * hash + _verifySslCertificate.GetHashCode();
            hash = 37 * hash + _waitQueueSize.GetHashCode();
            hash = 37 * hash + _waitQueueTimeout.GetHashCode();
            hash = 37 * hash + _writeConcern.GetHashCode();
            return(hash);
        }
        // private methods
        private int GetHashCodeHelper()
        {
            // see Effective Java by Joshua Bloch
            int hash = 17;

            hash = 37 * hash + connectionMode.GetHashCode();
            hash = 37 * hash + connectTimeout.GetHashCode();
            hash = 37 * hash + (defaultCredentials == null ? 0 : defaultCredentials.GetHashCode());
            hash = 37 * hash + guidRepresentation.GetHashCode();
            hash = 37 * hash + ipv6.GetHashCode();
            hash = 37 * hash + maxConnectionIdleTime.GetHashCode();
            hash = 37 * hash + maxConnectionLifeTime.GetHashCode();
            hash = 37 * hash + maxConnectionPoolSize.GetHashCode();
            hash = 37 * hash + minConnectionPoolSize.GetHashCode();
            hash = 37 * hash + (replicaSetName == null ? 0 : replicaSetName.GetHashCode());
            hash = 37 * hash + (safeMode == null ? 0 : safeMode.GetHashCode());
            if (servers != null)
            {
                foreach (var server in servers)
                {
                    hash = 37 * hash + server.GetHashCode();
                }
            }
            hash = 37 * hash + slaveOk.GetHashCode();
            hash = 37 * hash + socketTimeout.GetHashCode();
            hash = 37 * hash + waitQueueSize.GetHashCode();
            hash = 37 * hash + waitQueueTimeout.GetHashCode();
            return(hash);
        }