예제 #1
0
        /// <summary>
        /// Attempts to get OperationRetryCount value from ConnectionParameters of clients.
        /// If some clients have OperationRetryCount in their connection strings and its values are the same, then method returns that value. Otherwise it returns 'null'
        /// </summary>
        /// <param name="clients">Clients collection</param>
        /// <returns>OperationRetryCount value</returns>
        private static int?TryGetOperationRetryCountFromNodesConnectionParameters(BobNodeClient[] clients)
        {
            if (clients == null)
            {
                throw new ArgumentNullException(nameof(clients));
            }

            return(BobConnectionParameters.TryExtractValueFromMultipleParameters(clients.Select(o => o.ConnectionParameters), p => p.OperationRetryCount));
        }
예제 #2
0
        /// <summary>
        /// Attempts to get KeySerializationPoolSize value from ConnectionParameters of clients.
        /// If some clients have KeySerializationPoolSize in their connection strings and its values are the same, then method returns that value. Otherwise it returns 'null'
        /// </summary>
        /// <param name="clientConnectionParameters">Clients connection parameters collection</param>
        /// <returns>KeySerializationPoolSize value</returns>
        private static int?TryGetKeySerializationPoolSizeFromNodesConnectionParameters(IEnumerable <BobConnectionParameters> clientConnectionParameters)
        {
            if (clientConnectionParameters == null)
            {
                throw new ArgumentNullException(nameof(clientConnectionParameters));
            }

            return(BobConnectionParameters.TryExtractValueFromMultipleParameters(clientConnectionParameters, p => p.KeySerializationPoolSize));
        }
예제 #3
0
        /// <summary>
        /// Attempts to get NodeSelectionPolicyFactory value from ConnectionParameters of clients.
        /// If some clients have NodeSelectionPolicyFactory in their connection strings and its values are the same, then method returns that value. Otherwise it returns 'null'
        /// </summary>
        /// <param name="clients">Clients collection</param>
        /// <returns>NodeSelectionPolicyFactory value</returns>
        private static BobNodeSelectionPolicyFactory TryGetNodeSelectionPolicyFactoryFromNodesConnectionParameters(BobNodeClient[] clients)
        {
            if (clients == null)
            {
                throw new ArgumentNullException(nameof(clients));
            }

            KnownBobNodeSelectionPolicies?result = BobConnectionParameters.TryExtractValueFromMultipleParameters(clients.Select(o => o.ConnectionParameters), p => p.NodeSelectionPolicy);

            return(result != null?BobNodeSelectionPolicyFactory.FromKnownNodeSelectionPolicy(result.Value) : null);
        }