示例#1
0
        /// <summary>
        /// Creates a <see cref="ConfigurationClient"/> that sends requests to the configuration store.
        /// </summary>
        /// <param name="connectionString">Connection string with authentication option and related parameters.</param>
        /// <param name="options">Options that allow to configure the management of the request sent to the configuration store.</param>
        public ConfigurationClient(string connectionString, ConfigurationClientOptions options)
        {
            if (connectionString == null)
            {
                throw new ArgumentNullException(nameof(connectionString));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            ParseConnectionString(connectionString, out _baseUri, out var credential, out var secret);

            _pipeline = HttpPipelineBuilder.Build(options,
                                                  new HttpPipelinePolicy[] { new CustomHeadersPolicy() },
                                                  new HttpPipelinePolicy[] {
                new ApiVersionPolicy(options.GetVersionString()),
                new AuthenticationPolicy(credential, secret),
                new SyncTokenPolicy()
            },
                                                  new ResponseClassifier());
        }