コード例 #1
0
        /// <summary>
        /// Inject remote configuration source into configuration system
        /// </summary>
        public static IConfigurationBuilder AddRemoteConfiguration(
            this IConfigurationBuilder configuration,
            RemoteConfigConnectionParameters connectionParameters)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (connectionParameters == null)
            {
                throw new ArgumentNullException(nameof(connectionParameters));
            }

            var jsonProvider = new DefaultConfigJsonProvider(connectionParameters);

            configuration.Add(new RemoteConfigSource(jsonProvider));

            return(configuration);
        }
コード例 #2
0
        public static void AddRemoteConfiguration(
            IConfigurationBuilder configuration,
            RemoteConfigConnectionParameters connectionParameters,
            bool optional)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (connectionParameters == null)
            {
                throw new ArgumentNullException(nameof(connectionParameters));
            }

            var jsonProvider = new DefaultConfigJsonProvider(connectionParameters)
            {
                ThrowIfAddressNotSpecified = !optional
            };

            configuration.Add(new RemoteConfigSource(jsonProvider));
        }