Skip to content

calway/calway-configuration

Repository files navigation

Calway.Configuration

This library adds an SqlServer table as Configuration provider

Usage

Configure the Sql Provider in StartUp.

public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.ConfigureAppConfiguration(configurationBuilder =>
                        configurationBuilder.AddSqlServerTableConfiguration()                   
                    );

Then use configuration as usual

config.GetValue<int>("calendar:searchstepsize");
config.GetValue<bool>("agentmood:useagentmood");

By default the DefaultConnectionString is used to connect to the database, but this can be configured.

webBuilder.ConfigureAppConfiguration(configurationBuilder =>
	configurationBuilder.AddSqlServerTableConfiguration(new SqlTableConfigurationOptions() 
	{ 
		ConnectionStringName = "DefaultConnectionString", 
		CacheDuration = 60, 
		UpdateAllowed = true 
	})
);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages