Ejemplo n.º 1
0
        /// <summary>
        /// Builds <see cref="BobClusterClient{TKey}"/>
        /// </summary>
        /// <returns>Created cluster</returns>
        public BobClusterClient <TKey> Build()
        {
            if (_nodeConnectionParameters.Count == 0)
            {
                throw new InvalidOperationException("At least one node should be added to cluster");
            }

            List <BobConnectionParameters> localConnectionParameters = _nodeConnectionParameters;

            if (_operationTimeout != null || _connectionTimeout != null || _user != null)
            {
                for (int i = 0; i < localConnectionParameters.Count; i++)
                {
                    var connectionParamsBuilder = new BobConnectionParametersBuilder(localConnectionParameters[i]);

                    if (_operationTimeout != null)
                    {
                        connectionParamsBuilder.OperationTimeout = _operationTimeout;
                    }
                    if (_connectionTimeout != null)
                    {
                        connectionParamsBuilder.ConnectionTimeout = _connectionTimeout;
                    }

                    if (_user != null)
                    {
                        connectionParamsBuilder.User     = _user;
                        connectionParamsBuilder.Password = _password;
                    }

                    localConnectionParameters[i] = connectionParamsBuilder.Build();
                }
            }

            return(new BobClusterClient <TKey>(localConnectionParameters, _nodeSelectionPolicyFactory, _operationRetryCount, _keySerializer, _keySerializationPoolSize));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// <see cref="BobConnectionParametersBuilder"/> copy constructor from <see cref="BobConnectionParametersBuilder"/>
 /// </summary>
 /// <param name="sourceParameters">Source parameters</param>
 public BobConnectionParametersBuilder(BobConnectionParametersBuilder sourceParameters)
     : this((IModifiableBobConnectionParameters)sourceParameters)
 {
 }