Arebis.Core.Configuration.SqlServer
8.0.0
dotnet add package Arebis.Core.Configuration.SqlServer --version 8.0.0
NuGet\Install-Package Arebis.Core.Configuration.SqlServer -Version 8.0.0
<PackageReference Include="Arebis.Core.Configuration.SqlServer" Version="8.0.0" />
<PackageVersion Include="Arebis.Core.Configuration.SqlServer" Version="8.0.0" />
<PackageReference Include="Arebis.Core.Configuration.SqlServer" />
paket add Arebis.Core.Configuration.SqlServer --version 8.0.0
#r "nuget: Arebis.Core.Configuration.SqlServer, 8.0.0"
#:package Arebis.Core.Configuration.SqlServer@8.0.0
#addin nuget:?package=Arebis.Core.Configuration.SqlServer&version=8.0.0
#tool nuget:?package=Arebis.Core.Configuration.SqlServer&version=8.0.0
Arebis.Core.Configuration.SqlServer
A SQL server configuration source for .NET Core applications.
Configuration setup
Use the following code to add the SQL Server configuration provider:
builder.Configuration.AddSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")!);
You can also specify the environment and refresh interval:
builder.Configuration.AddSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")!, environment: "Production", refreshInterval: TimeSpan.FromSeconds(10));
If not specified, the environment is taken from the ASPNETCORE_ENVIRONMENT variable (or defaults to "Production" if not set), and no refreshes are performed.
Not that to use refreshed option values, you should use IOptionsSnapshot<T> or IOptionsMonitor<T> instead of IOptions<T>.
Database setup
Us the following script to create the required table:
IF NOT EXISTS (SELECT * FROM sys.schemas WHERE name = 'config')
BEGIN
EXECUTE ('CREATE SCHEMA [config] AUTHORIZATION [dbo]')
END
GO
CREATE TABLE [config].[AppConfiguration]
(
[Id] int IDENTITY(1,1) NOT NULL,
[Key] nvarchar(200) NOT NULL,
[Value] nvarchar(max) NULL,
[Environment] nvarchar(100) NULL,
CONSTRAINT [PK_AppConfiguration] PRIMARY KEY CLUSTERED ([Id] ASC)
) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_AppConfiguration_Key_Environment] ON [config].[AppConfiguration] ([Key] ASC, [Environment] ASC)
GO
Configuring values
Insert configuration values into the table as follows:
INSERT INTO [config].[AppConfiguration] ([Key], [Value], [Environment])
VALUES ('MySection:MyKey', 'MyValue', 'Production');
A value of NULL in the Environment column indicates that the setting is for all environments (unless overwritten for a specific environment).
Use the colon (:) character to indicate sections and subsections.
Credits
Implementation is based on: https://mousavi310.github.io/posts/a-refreshable-sql-server-configuration-provider-for-net-core/.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net8.0
- Microsoft.Data.SqlClient (>= 5.2.2)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Primitives (>= 8.0.0)
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 |
|---|---|---|
| 8.0.0 | 393 | 1/19/2026 |