public ServiceEndpoint(string connectionString, EndpointType type = EndpointType.Primary, string name = "")
        {
            // The provider is responsible to check if the connection string is empty and throw correct error message
            if (!string.IsNullOrEmpty(connectionString))
            {
                string key;
                (Endpoint, key, Version, Port) = ConnectionStringParser.Parse(connectionString);
                AccessKey = new AccessKey(key);
            }

            EndpointType     = type;
            ConnectionString = connectionString;
            Name             = name;
        }
Exemple #2
0
        public ServiceEndpoint(string connectionString, EndpointType type = EndpointType.Primary, string name = "")
        {
            if (string.IsNullOrWhiteSpace(connectionString))
            {
                throw new ArgumentException($"'{nameof(connectionString)}' cannot be null or whitespace", nameof(connectionString));
            }

            string key;

            (Endpoint, key, Version, Port, ClientEndpoint) = ConnectionStringParser.Parse(connectionString);
            AccessKey = new AccessKey(key);

            EndpointType     = type;
            ConnectionString = connectionString;
            Name             = name;
        }
Exemple #3
0
        /// <summary>
        /// Connection string constructor
        /// </summary>
        /// <param name="connectionString"></param>
        /// <param name="type"></param>
        /// <param name="name"></param>
        public ServiceEndpoint(string connectionString, EndpointType type = EndpointType.Primary, string name = "")
        {
            if (string.IsNullOrWhiteSpace(connectionString))
            {
                throw new ArgumentException($"'{nameof(connectionString)}' cannot be null or whitespace", nameof(connectionString));
            }

            (AccessKey, Version, ClientEndpoint) = ConnectionStringParser.Parse(connectionString);
            AudienceBaseUrl = BuildAudienceBaseUrl(AccessKey.Endpoint);
            Endpoint        = BuildServerEndpoint(AccessKey.Endpoint);
            ClientEndpoint ??= Endpoint;

            EndpointType     = type;
            ConnectionString = connectionString;
            Name             = name;
        }