예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="path"></param>
        /// <param name="optional"></param>
        /// <param name="reloadOnChange"></param>
        /// <param name="asckey"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"></exception>
        /// <exception cref="ArgumentException"></exception>
        public static IConfigurationBuilder AddRootJsonFile(this IConfigurationBuilder builder, string path, bool optional,
                                                            bool reloadOnChange, string asckey)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentException("File path must be a non-empty string.");
            }

            var source = new JsonRootConfigurationSource
            {
                FileProvider   = null,
                Path           = path,
                Optional       = optional,
                ReloadOnChange = reloadOnChange,
                Key            = asckey
            };

            source.ResolveFileProvider();
            builder.Add(source);
            return(builder);
        }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="source"></param>
 public JsonRootConfigurationProvider(JsonRootConfigurationSource source) : base(source)
 {
     _source = source;
 }