/// <summary>
        /// Adds the cache file.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="provider">The provider.</param>
        /// <param name="path">The path.</param>
        /// <param name="basePath">The base path.</param>
        /// <param name="optional">if set to <c>true</c> [optional].</param>
        /// <param name="reloadOnChange">if set to <c>true</c> [reload on change].</param>
        /// <returns>IConfigurationBuilder.</returns>
        public static IConfigurationBuilder AddCacheFile(this IConfigurationBuilder builder, IFileProvider provider,
                                                         string path, string basePath, bool optional, bool reloadOnChange)
        {
            Check.NotNull(builder, "builder");
            //获取一个环境变量的路径
            Check.CheckCondition(() => string.IsNullOrEmpty(path), "path");
            path = EnvironmentHelper.GetEnvironmentVariable(path);
            if (provider == null && Path.IsPathRooted(path))
            {
                provider = new PhysicalFileProvider(Path.GetDirectoryName(path));
                path     = Path.GetFileName(path);
            }

            //建立CacheConfigurationSource类,此类继承了FileConfigurationSource接口,并重写加入了json转换方法
            var source = new CacheConfigurationSource
            {
                FileProvider   = provider,
                Path           = path,
                Optional       = optional,
                ReloadOnChange = reloadOnChange
            };

            builder.Add(source);
            if (!string.IsNullOrEmpty(basePath))
            {
                builder.SetBasePath(basePath);
            }
            AppConfig.Path          = path;
            AppConfig.Configuration = builder.Build();
            return(builder);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CacheConfigurationProvider" /> class.
 /// </summary>
 /// <param name="source">The source.</param>
 public CacheConfigurationProvider(CacheConfigurationSource source) : base(source)
 {
 }