Skip to content

Instantly share code, notes, and snippets.

@kasunkv
Created February 3, 2020 07:55
Show Gist options
  • Save kasunkv/9bc1767f9e79f2e3fee043ea2409f0b5 to your computer and use it in GitHub Desktop.
Save kasunkv/9bc1767f9e79f2e3fee043ea2409f0b5 to your computer and use it in GitHub Desktop.
Using LocalFileOfflineCache implementation
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => {
webBuilder.UseStartup<Startup>();
})
.ConfigureAppConfiguration((context, config) => {
var settings = config.Build();
var appConfigEndpoint = settings["AppSettings:AppConfiguration:Endpoint"];
if (!string.IsNullOrEmpty(appConfigEndpoint))
{
var endpoint = new Uri(appConfigEndpoint);
config.AddAzureAppConfiguration(options =>
{
...
options
// Use the custom IOfflineCache implementation
.SetOfflineCache(new LocalFileOfflineCache(context.HostingEnvironment));
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment