Created
April 18, 2021 13:34
-
-
Save manoj-choudhari-git/a39753a69d3d84570c6a24c68cf466df to your computer and use it in GitHub Desktop.
Custom Configuration Source returning instance of IConfigurationProvider implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Microsoft.EntityFrameworkCore; | |
using Microsoft.Extensions.Configuration; | |
namespace CustomConfigProviderExample.CustomConfigProvider | |
{ | |
public class CustomConfigurationSource : IConfigurationSource | |
{ | |
private readonly Action<DbContextOptionsBuilder> _optionsAction; | |
public CustomConfigurationSource(Action<DbContextOptionsBuilder> optionsAction) | |
{ | |
_optionsAction = optionsAction; | |
} | |
public IConfigurationProvider Build(IConfigurationBuilder builder) | |
{ | |
return new CustomConfigurationProvider(_optionsAction); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment