Imato.ConfigurationProvider.SqlServer 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package Imato.ConfigurationProvider.SqlServer --version 1.0.3
                    
NuGet\Install-Package Imato.ConfigurationProvider.SqlServer -Version 1.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Imato.ConfigurationProvider.SqlServer" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Imato.ConfigurationProvider.SqlServer" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Imato.ConfigurationProvider.SqlServer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Imato.ConfigurationProvider.SqlServer --version 1.0.3
                    
#r "nuget: Imato.ConfigurationProvider.SqlServer, 1.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Imato.ConfigurationProvider.SqlServer@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Imato.ConfigurationProvider.SqlServer&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Imato.ConfigurationProvider.SqlServer&version=1.0.3
                    
Install as a Cake Tool
Imato.ConfigurationProvider.SqlServer
Setup

Add startup configuration

var builder = Host.CreateApplicationBuilder(args);
builder.Configuration.AddSqlConfigurations(c =>
{
    // Connection name in Configurations to configuration DB. 
    // Try to use Env variable like ConnectionStrings__Configurations. 
    // Default value: "Configurations"
    c.ConnectionStringName = "Configurations";
    // Or use your connection string
    c.ConnectionString = "";
    // Table for configuration store. Default value: "Configurations"
    c.TableName = "Configurations"; 
    // Table sachem for configuration store. Default value: "dbo"
    c.SchemaName = "dbo"; 
    // Update options interval. Default: 5 min
    c.RefreshInterval = TimeSpan.FromMinutes(5); 
    // App name in configuration table. Default: current package id
    c.AppName = Assembly.GetEntryAssembly()?.GetName().Name;
    //.NET CORE Environment name from ASPNETCORE_ENVIRONMENT. Default: "Development" 
    c.EnvironmentName = "Development"; 
    // Save your new local appsettings configuration keys into DB on start. Default: false
    c.SyncLocalConfigsToDb = true; 
});

and your table TableName from connection ConnectionStringName will be saved and updated every RefreshInterval in IConfiguration.
Table will be created in startup process. Your user should be have permision for create new Table in DB.

Using

Just get option from DB table in IConfiguration.

appsettings.json
{
	"Test1": {
		"Foo": "ddff",
		"Bar": 4
	}
}
public record Test1(string Foo, int Bar);

var value = configureation.GetValueOf<Test1>();
Console.WriteLine($"Test1: {JsonSerializer.Serialize(value)}");

You can update, save same konfiguration key in table

var provider = configureation.GetConfigurationProvider<SqlConfigurationProvider>();
provider.Set("Test1:Bar", (value.Bar + 1).ToString());
// OR
configuration.SetValue("Test1:Bar", (value.Bar + 1).ToString());

Manual update value in table

update dbo.Configurations
	set Value = '500'
	where [Key] = 'Test1:Bar'
		and App = 'Imato.TestApp'
		and Environment = 'Development';

Table track changes: previous value and user name

select * 
	from dbo.Configurations 
	where [Key] = 'Test1:Bar'
		and App = 'Imato.TestApp'
		and Environment = 'Development';


Id  App	            Environment Key	        Value	PrevValue   UpdateDate	                        UpdateUser
2   Imato.TestApp   Development Test1:Bar	509     508         2026-06-04 14:53:18.6911166 +03:00  test_user

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4 81 6/16/2026
1.0.3 106 6/9/2026
1.0.2 92 6/2/2026
1.0.1 95 5/29/2026
1.0.0 89 5/29/2026

Ready to use