protected virtual void GetEnvironmentInformation(
            out string clientVersion,
            out string processArchitecture,
            out string operatingSystem,
            out string runtimeFramework)
        {
            EnvironmentInformation environmentInformation = new EnvironmentInformation();

            clientVersion       = environmentInformation.ClientVersion;
            processArchitecture = environmentInformation.ProcessArchitecture;
            operatingSystem     = environmentInformation.OperatingSystem;
            runtimeFramework    = environmentInformation.RuntimeFramework;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new CosmosClientOptions
        /// </summary>
        public CosmosClientOptions()
        {
            this.UserAgentContainer = new UserAgentContainer();
            EnvironmentInformation environmentInformation = new EnvironmentInformation();

            this.currentEnvironmentInformation = environmentInformation.ToString();
            this.UserAgentContainer.Suffix     = this.currentEnvironmentInformation;
            this.GatewayModeMaxConnectionLimit = ConnectionPolicy.Default.MaxConnectionLimit;
            this.RequestTimeout     = ConnectionPolicy.Default.RequestTimeout;
            this.ConnectionMode     = CosmosClientOptions.DefaultConnectionMode;
            this.ConnectionProtocol = CosmosClientOptions.DefaultProtocol;
            this.ApiType            = CosmosClientOptions.DefaultApiType;
            this.CustomHandlers     = new Collection <RequestHandler>();
        }
Ejemplo n.º 3
0
        private string CreateBaseUserAgentString()
        {
            EnvironmentInformation environmentInformation = new EnvironmentInformation();
            string operatingSystem = environmentInformation.OperatingSystem;

            if (operatingSystem.Length > MaxOperatingSystemString)
            {
                operatingSystem = operatingSystem.Substring(0, MaxOperatingSystemString);
            }

            // Regex replaces all special characters with empty space except . - | since they do not cause format exception for the user agent string.
            // Do not change the cosmos-netstandard-sdk as it is required for reporting
            return($"cosmos-netstandard-sdk/{environmentInformation.ClientVersion}" + Regex.Replace($"|{environmentInformation.DirectVersion}|{environmentInformation.ClientId}|{environmentInformation.ProcessArchitecture}|{operatingSystem}|{environmentInformation.RuntimeFramework}|", @"[^0-9a-zA-Z\.\|\-]+", " "));
        }
Ejemplo n.º 4
0
        static UserAgentContainer()
        {
            EnvironmentInformation environmentInformation = new EnvironmentInformation();

            UserAgentContainer.baseUserAgent = environmentInformation.ToString();
        }