diff --git a/Fig.All/Fig.All.csproj b/Fig.All/Fig.All.csproj
index 02b5fed..ab87bd6 100644
--- a/Fig.All/Fig.All.csproj
+++ b/Fig.All/Fig.All.csproj
@@ -11,8 +11,6 @@
true
https://github.com/devrexlabs/fig
https://github.com/devrexlabs/fig
- Robert Friberg et al
- Updated nugets, dump config as string
MIT
@@ -20,6 +18,7 @@
+
diff --git a/Fig.SqlSettings/Fig.SqlSettings.csproj b/Fig.SqlSettings/Fig.SqlSettings.csproj
index a82aa65..f9f745b 100644
--- a/Fig.SqlSettings/Fig.SqlSettings.csproj
+++ b/Fig.SqlSettings/Fig.SqlSettings.csproj
@@ -1,15 +1,17 @@
+ snupkg
netstandard2.0
true
Venomaus
+ Fig.SqlSettings
Fig support for sql providers
Venomaus
MIT
https://github.com/devrexlabs/fig
https://github.com/devrexlabs/fig
- Implementation of SqlProvider support for Fig
+ 1.2.0
diff --git a/README.md b/README.md
index ae0b572..83c0906 100644
--- a/README.md
+++ b/README.md
@@ -112,6 +112,7 @@ by subscribing to the `PropertyChanged` event.
* ini-files
* environment variables
* command line / string array
+* Sql database
* Bring your own by implementing `ISettingsSource`
Sources provide key value pairs `(string,string)`.
@@ -217,7 +218,6 @@ MYAPP.COLOR
MYAPP.ENDPOINT
```
-
## Command line
Fig can take key/value paires passed on the command line. The default prefix is "--fig:" and default separator is "="
```c#
@@ -240,6 +240,38 @@ and `settingsBuilder.UseCommandLine(args, prefix: "")` yields:
retries
```
+## Sql database
+Version 1.9 introduces SqlSettings. Read keys and values from any sql database
+that has an ADO.NET provider. (implements `IDbConnection`)
+
+First, `Install-Package Fig.SqlSettings`, then use one of the `UseSql` extension method
+overloads to setup a connection to your database.
+
+```csharp
+ //pass an IDbConnection with a preconfigured connection string
+ IDbConnection connection = new SqlConnection("Data source=.;Integrated Security=true;Database=mydb");
+ var settings = new SettingsBuilder()
+ .UseSql(connection)
+ .Build();
+```
+
+```csharp
+ //pass a type parameter for the `IDbConnection` implementation class
+ //and a connection string key to pick up from AppSettingsXml / AppSettingsJson
+ var settings = new SettingsBuilder()
+ .UseAppSettingsJson("appsettings.json")
+ .UseSql("ConnectionStrings.SQLiteConnection")
+ .Build();
+```
+The SQL query used is `SELECT key, value FROM FigSettings`. You can pass your own query:
+
+```
+ var settings = new SettingsBuilder()
+ .UseAppSettingsJson("appsettings.json")
+ .UseSql("ConnectionStrings.SQLiteConnection", "SELECT a,b FROM MySettings")
+ .Build();
+```
+
# Combining sources
Use the `SettingsBuilder` to add sources in order of precedence.
Settings in above layers override settings with the same key in
@@ -277,7 +309,7 @@ You can also qualify an entire section of an ini or json file:
"Network:PROD" : {
"ip" : "10.0.0.1",
"port" : 3001
- }
+ },
"Network:TEST" : {
"ip" : "127.0.0.1",
diff --git a/appveyor.yml b/appveyor.yml
index aa41b75..0d70b04 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,4 +1,4 @@
-version: 1.8.{build}
+version: 1.9.{build}
image: Ubuntu1804
assembly_info:
patch: true