Shiny.Extensions.Configuration.Sqlite
1.1.1
Prefix Reserved
See the version list below for details.
dotnet add package Shiny.Extensions.Configuration.Sqlite --version 1.1.1
NuGet\Install-Package Shiny.Extensions.Configuration.Sqlite -Version 1.1.1
<PackageReference Include="Shiny.Extensions.Configuration.Sqlite" Version="1.1.1" />
paket add Shiny.Extensions.Configuration.Sqlite --version 1.1.1
#r "nuget: Shiny.Extensions.Configuration.Sqlite, 1.1.1"
// Install Shiny.Extensions.Configuration.Sqlite as a Cake Addin
#addin nuget:?package=Shiny.Extensions.Configuration.Sqlite&version=1.1.1
// Install Shiny.Extensions.Configuration.Sqlite as a Cake Tool
#tool nuget:?package=Shiny.Extensions.Configuration.Sqlite&version=1.1.1
Xamarin Configuration for Microsoft.Extensions.Configuration
Nugets
Release | NuGet |
---|---|
Stable | |
Preview |
Features
- All the power of IConfiguration
- Load JSON from packaged sources (whitelabellers can unpack, edit, & repack the config)
- Preferences based configuration source with writebacks
- Support For
- Xamarin
- iOS
- Android
- Including Xamarin Forms 😛
- .NET 6 is coming
- Xamarin
The Problem
Microsoft really did create a great set of abstractions for configuration. You can store a set of key/values, cause a reload when a configuration source changes, & bind to strongly typed objects using Microsoft.Extensions.Configuration.Binder. On Mobile though, NONE of the current providers aren't really well.
Why?
- A big feature for IConfiguration, is the ability to trigger a reload of it's source without restarting the application. Changing an appsettings.json file during runtime causes the IConfiguration to trigger a reload notification.
- Mobile doesn't really have an appsettings.json. Sure you could put this in an embedded resource, but than it is readonly at all times other than the build process... after that - it is locked in place
- Essentially, IConfiguration becomes a string based dictionary for all intents and purposes - pretty useless considering
The Solution
How Shiny.Extensions.Configuration brings the power of IConfiguration to Mobile!
- A platform preferences configuration source which allows you to WRITE a value back using IConfiguration[key] = value;
- A whitelabellers dream - the ability to unpack, change a json config file, and repack without trigger a build by using proper platform directories to load up the JSON files while still having the power of a proper configuration library internally.
Setup
AppSettings JSON
- Install the NuGet package 'Shiny.Extensions.Configuration'
- Create an appsettings.json file like you would in ASP.NET Core application in your HEAD project.
- ANDROID: place the file in: Assets. Ensure the build action on the file is set to 'AndroidAsset'
- iOS: place the file in the ROOT of your project. Ensure the build action on the file is set to 'BundleResource'
- Configure your IConfiguration using the following code in your application startup code (ie. Xamarin.Forms App).
// store this in your dependency injection container OR static class
var config = new ConfigurationBuilder()
.AddJsonPlatformBundle() // NOTE: you can change the name of appsettings.json to something else and pass as an argument here
.Build();
Preferences Provider
This provider allows writes and persists across application restarts. It is a wrapper around the Android/iOS shared preferences.
- Install the NuGet package 'Shiny.Extensions.Configuration'
- For this configuration source, nothing special is required, simply add the following to the configuration builder:
var configuration = new ConfigurationBuilder()
.AddPlatformPreferences()
.Build();
NOTE: with the platform preferences provider, changes are supported.
IConfiguration config = ...; // build
config["key"] = "value"; // write - this will cause a persist to the platform prefs and also trigger Option reloated events
Links
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.Data.Sqlite (>= 6.0.3)
- Microsoft.Extensions.Configuration (>= 6.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 | |
---|---|---|---|
1.2.2-alpha | 193 | 3/29/2022 | |
1.2.0-preview-0015 | 160 | 4/5/2022 | |
1.2.0-preview-0012 | 156 | 3/29/2022 | |
1.1.13-preview | 161 | 3/29/2022 | |
1.1.12-pre | 172 | 3/27/2022 | |
1.1.1 | 459 | 4/5/2022 | |
1.1.1-g4ab8a2e644 | 156 | 4/5/2022 | |
1.1.0-preview.19 | 136 | 3/27/2022 |