namespace Microsoft.Extensions.Configuration
public static class FileConfigurationExtensions
{
public static IConfigurationBuilder SetFileProvider(this IConfigurationBuilder builder, IFileProvider fileProvider)
{
if (builder == null)
{
throw new ArgumentNullException(nameof(builder));
}
builder.Properties[FileProviderKey] = fileProvider ?? throw new ArgumentNullException(nameof(fileProvider));
return builder;
}
public static IConfigurationBuilder SetBasePath(this IConfigurationBuilder builder, string basePath)
{
if (builder == null)
{
throw new ArgumentNullException(nameof(builder));
}
if (basePath == null)
{
throw new ArgumentNullException(nameof(basePath));
}
return builder.SetFileProvider(new PhysicalFileProvider(basePath));
}
}