public SingletonCosmosClientWrapper([NotNull] ICosmosSingletonOptions options)
        {
            var configuration = new CosmosClientOptions(options.ServiceEndPoint, options.AuthKeyOrResourceToken)
            {
                ApplicationName = _userAgent,
                ConnectionMode  = ConnectionMode.Direct
            };

            if (options.Region != null)
            {
                configuration.ApplicationRegion = options.Region;
            }

            _options = configuration;
        }
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        public SingletonCosmosClientWrapper([NotNull] ICosmosSingletonOptions options)
        {
            _endpoint = options.AccountEndpoint;
            _key      = options.AccountKey;
            var configuration = new CosmosClientOptions
            {
                ApplicationName = _userAgent, ConnectionMode = options.ConnectionMode ?? ConnectionMode.Direct
            };

            if (options.Region != null)
            {
                configuration.ApplicationRegion = options.Region;
            }

            _options = configuration;
        }
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        public SingletonCosmosClientWrapper(ICosmosSingletonOptions options)
        {
            _endpoint         = options.AccountEndpoint;
            _key              = options.AccountKey;
            _connectionString = options.ConnectionString;
            var configuration = new CosmosClientOptions {
                ApplicationName = _userAgent, Serializer = new JsonCosmosSerializer()
            };

            if (options.Region != null)
            {
                configuration.ApplicationRegion = options.Region;
            }

            if (options.LimitToEndpoint != null)
            {
                configuration.LimitToEndpoint = options.LimitToEndpoint.Value;
            }

            if (options.ConnectionMode != null)
            {
                configuration.ConnectionMode = options.ConnectionMode.Value;
            }

            if (options.WebProxy != null)
            {
                configuration.WebProxy = options.WebProxy;
            }

            if (options.RequestTimeout != null)
            {
                configuration.RequestTimeout = options.RequestTimeout.Value;
            }

            if (options.OpenTcpConnectionTimeout != null)
            {
                configuration.OpenTcpConnectionTimeout = options.OpenTcpConnectionTimeout.Value;
            }

            if (options.IdleTcpConnectionTimeout != null)
            {
                configuration.IdleTcpConnectionTimeout = options.IdleTcpConnectionTimeout.Value;
            }

            if (options.GatewayModeMaxConnectionLimit != null)
            {
                configuration.GatewayModeMaxConnectionLimit = options.GatewayModeMaxConnectionLimit.Value;
            }

            if (options.MaxTcpConnectionsPerEndpoint != null)
            {
                configuration.MaxTcpConnectionsPerEndpoint = options.MaxTcpConnectionsPerEndpoint.Value;
            }

            if (options.MaxRequestsPerTcpConnection != null)
            {
                configuration.MaxRequestsPerTcpConnection = options.MaxRequestsPerTcpConnection.Value;
            }

            if (options.HttpClientFactory != null)
            {
                configuration.HttpClientFactory = options.HttpClientFactory;
            }

            _options = configuration;
        }
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        public SingletonCosmosClientWrapper([NotNull] ICosmosSingletonOptions options)
        {
            _endpoint         = options.AccountEndpoint;
            _key              = options.AccountKey;
            _connectionString = options.ConnectionString;
            var configuration = new CosmosClientOptions
            {
                ApplicationName = _userAgent
            };

            if (options.Region != null)
            {
                configuration.ApplicationRegion = options.Region;
            }

            if (options.LimitToEndpoint != null)
            {
                configuration.LimitToEndpoint = options.LimitToEndpoint.Value;
            }

            if (options.AllowBulkExecution != null)
            {
                configuration.AllowBulkExecution = options.AllowBulkExecution.Value;
            }

            if (options.ConnectionMode != null)
            {
                configuration.ConnectionMode = options.ConnectionMode.Value;
            }

            if (options.WebProxy != null)
            {
                configuration.WebProxy = options.WebProxy;
            }

            if (options.RequestTimeout != null)
            {
                configuration.RequestTimeout = options.RequestTimeout.Value;
            }

            if (options.OpenTcpConnectionTimeout != null)
            {
                configuration.OpenTcpConnectionTimeout = options.OpenTcpConnectionTimeout.Value;
            }

            if (options.IdleTcpConnectionTimeout != null)
            {
                configuration.IdleTcpConnectionTimeout = options.IdleTcpConnectionTimeout.Value;
            }

            if (options.PortReuseMode != null)
            {
                configuration.PortReuseMode = options.PortReuseMode.Value;
            }

            if (options.TcpConnectionEndpointRediscoveryEnabled != null)
            {
                configuration.EnableTcpConnectionEndpointRediscovery = options.TcpConnectionEndpointRediscoveryEnabled.Value;
            }

            if (options.GatewayModeMaxConnectionLimit != null)
            {
                configuration.GatewayModeMaxConnectionLimit = options.GatewayModeMaxConnectionLimit.Value;
            }

            if (options.MaxTcpConnectionsPerEndpoint != null)
            {
                configuration.MaxTcpConnectionsPerEndpoint = options.MaxTcpConnectionsPerEndpoint.Value;
            }

            if (options.MaxRequestsPerTcpConnection != null)
            {
                configuration.MaxRequestsPerTcpConnection = options.MaxRequestsPerTcpConnection.Value;
            }

            _options = configuration;
        }