DBGang.Configuration.SQLServer
1.0.0
dotnet add package DBGang.Configuration.SQLServer --version 1.0.0
NuGet\Install-Package DBGang.Configuration.SQLServer -Version 1.0.0
<PackageReference Include="DBGang.Configuration.SQLServer" Version="1.0.0" />
paket add DBGang.Configuration.SQLServer --version 1.0.0
#r "nuget: DBGang.Configuration.SQLServer, 1.0.0"
// Install DBGang.Configuration.SQLServer as a Cake Addin
#addin nuget:?package=DBGang.Configuration.SQLServer&version=1.0.0
// Install DBGang.Configuration.SQLServer as a Cake Tool
#tool nuget:?package=DBGang.Configuration.SQLServer&version=1.0.0
This is a SQL Server configuration provider implementation for Microsoft.Extensions.Configuration. Now you can store configuration data for all your applications in a central place (SQL Server) and it provides a convenient way to retrieve them.
To use it, you need to create the following database tables first:
CREATE TABLE [dbo].[Apps]( [AppID] [uniqueidentifier] NOT NULL CONSTRAINT DF_Apps_AppID DEFAULT newid(), [AppName] varchar NOT NULL, [Environment] varchar NOT NULL, [HostName] varchar NOT NULL, [Owner] varchar NOT NULL, [CreatedBy] varchar NOT NULL, [CreatedOn] [datetime] NOT NULL, [LastModifiedBy] varchar NULL, [LastModifiedOn] [datetime] NULL, CONSTRAINT [PK_Apps] PRIMARY KEY CLUSTERED ( [AppID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY], CONSTRAINT [UQ_Apps] UNIQUE NONCLUSTERED ( [AppName] ASC, [Environment] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO
CREATE TABLE [dbo].[AppConfigurations]( [AppID] [uniqueidentifier] NOT NULL, [Key] varchar NOT NULL, [Value] varchar NOT NULL, CONSTRAINT [PK_AppConfigurations] PRIMARY KEY CLUSTERED ( [AppID] ASC, [Key] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO
ALTER TABLE [dbo].[AppConfigurations] WITH CHECK ADD CONSTRAINT [FK_AppConfigurations_Apps] FOREIGN KEY([AppID]) REFERENCES [dbo].[Apps] ([AppID]) GO
After you added configuration data in AppConfiguration table, you can test it with the following code:
using System; using Microsoft.Extensions.Configuration; using DBGang.Configuration.SQLServer;
namespace TestSQLServer { class Program { static void Main(string[] args) { IConfiguration config = new ConfigurationBuilder() .AddSQLServerConfiguration( "Server=myServer;Database=myDatabase;User Id=myUsername;Password=myPassword", "A8A22FE1-34DE-4BF2-96BF-D6CC6C17D753" // AppID in dbo.Apps table for the specific application ) .Build();
Console.WriteLine(config["key1"]);
Console.WriteLine(config["key2"]);
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.Configuration (>= 2.2.0)
- System.Data.SqlClient (>= 4.6.1)
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.0 | 570 | 7/15/2019 |