public static IConfigurationBuilder AddCustomJsonFile(this IConfigurationBuilder builder, IFileProvider provider, string path, bool optional, bool reloadOnChange) { if (provider == null && Path.IsPathRooted(path)) { provider = new PhysicalFileProvider(Path.GetDirectoryName(path)); path = Path.GetFileName(path); } var source = new CustomJsonConfigurationSource { FileProvider = provider, Path = path, Optional = optional, ReloadOnChange = reloadOnChange }; builder.Add(source); return(builder); }
public static IConfigurationBuilder AddJsonFileCustom(this IConfigurationBuilder builder, string path, bool optional, bool reloadOnChange) { 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 CustomJsonConfigurationSource { FileProvider = null, Path = path, Optional = optional, ReloadOnChange = reloadOnChange }; source.ResolveFileProvider(); builder.Add(source); return(builder); }
public CustomJsonConfigurationProvider(CustomJsonConfigurationSource source) : base(source) { OriginalData = new Dictionary <string, string>(); }