Esempio n. 1
0
        public DbConfigurationProvider(DbConfigurationSource source, IDbContextFactory dbContextFactory)
        {
            _dbContextFactory = dbContextFactory;

            if (source.ReloadOnChange)
            {
                ChangeToken.OnChange(source.Watch, Load);
            }
        }
Esempio n. 2
0
        public static IWebHostBuilder UseDbSettings(this IWebHostBuilder builder, bool reloadOnChange = true)
        {
            var dbConfigurationSource = new DbConfigurationSource {
                ReloadOnChange = reloadOnChange
            };

            return(builder
                   .ConfigureAppConfiguration((_, config) =>
            {
                config.Add(dbConfigurationSource);
            })
                   .ConfigureServices((_, services) =>
            {
                services.AddSingleton <INotificationHandler <SettingsChanged> >(dbConfigurationSource);
            }));
        }