Skip to content

Latest commit

 

History

History
38 lines (29 loc) · 1.04 KB

README.md

File metadata and controls

38 lines (29 loc) · 1.04 KB

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 
	})
);