Shiny.Extensions.Configuration
1.1.1
Prefix Reserved
See the version list below for details.
dotnet add package Shiny.Extensions.Configuration --version 1.1.1
NuGet\Install-Package Shiny.Extensions.Configuration -Version 1.1.1
<PackageReference Include="Shiny.Extensions.Configuration" Version="1.1.1" />
<PackageVersion Include="Shiny.Extensions.Configuration" Version="1.1.1" />
<PackageReference Include="Shiny.Extensions.Configuration" />
paket add Shiny.Extensions.Configuration --version 1.1.1
#r "nuget: Shiny.Extensions.Configuration, 1.1.1"
#addin nuget:?package=Shiny.Extensions.Configuration&version=1.1.1
#tool nuget:?package=Shiny.Extensions.Configuration&version=1.1.1
Xamarin Configuration for Microsoft.Extensions.Configuration
Nugets
Release | NuGet |
---|---|
Stable | |
Preview |
Builds
Branch | Status |
---|---|
Master | |
Dev | |
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
- Android
- iOS
- Including MAUI 😛
- 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-android31.0 is compatible. net6.0-ios was computed. net6.0-ios15.2 is compatible. net6.0-maccatalyst was computed. net6.0-maccatalyst15.2 is compatible. 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. 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. |
.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. monoandroid12.0 is compatible. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. xamarinios10 is compatible. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.Configuration (>= 6.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 6.0.0)
- Microsoft.Extensions.Configuration.Json (>= 6.0.0)
-
MonoAndroid 12.0
- Microsoft.Extensions.Configuration (>= 6.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 6.0.0)
- Microsoft.Extensions.Configuration.Json (>= 6.0.0)
- Xamarin.AndroidX.Preference (>= 1.1.1.13)
-
net6.0-android31.0
- Microsoft.Extensions.Configuration (>= 6.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 6.0.0)
- Microsoft.Extensions.Configuration.Json (>= 6.0.0)
- Xamarin.AndroidX.Preference (>= 1.1.1.13)
-
net6.0-ios15.2
- Microsoft.Extensions.Configuration (>= 6.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 6.0.0)
- Microsoft.Extensions.Configuration.Json (>= 6.0.0)
-
net6.0-maccatalyst15.2
- Microsoft.Extensions.Configuration (>= 6.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 6.0.0)
- Microsoft.Extensions.Configuration.Json (>= 6.0.0)
-
Xamarin.iOS 1.0
- Microsoft.Extensions.Configuration (>= 6.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 6.0.0)
- Microsoft.Extensions.Configuration.Json (>= 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 |
---|---|---|
4.0.0-beta-0069 | 112 | 4 days ago |
4.0.0-beta-0061 | 134 | 10 days ago |
4.0.0-beta-0057 | 136 | 11 days ago |
4.0.0-beta-0055 | 112 | 16 days ago |
4.0.0-beta-0054 | 447 | 17 days ago |
4.0.0-beta-0049 | 68 | 22 days ago |
4.0.0-beta-0048 | 81 | 22 days ago |
4.0.0-beta-0047 | 129 | 24 days ago |
4.0.0-beta-0040 | 3,424 | 10 months ago |
3.4.0-beta-0010 | 184 | a month ago |
3.4.0-beta-0009 | 83 | 2 months ago |
3.4.0-beta-0006 | 75 | 2 months ago |
3.4.0-beta-0005 | 80 | 2 months ago |
3.4.0-beta-0003 | 93 | 2 months ago |
3.3.4 | 3,504 | 3 months ago |
3.3.3 | 12,813 | 4/8/2024 |
3.3.3-beta-0007 | 110 | 4/8/2024 |
3.3.3-beta-0003 | 96 | 4/8/2024 |
3.3.2 | 296 | 3/26/2024 |
3.3.1 | 131 | 3/26/2024 |
3.3.0 | 259 | 3/18/2024 |
3.3.0-beta-0011 | 115 | 3/14/2024 |
3.3.0-beta-0009 | 115 | 3/12/2024 |
3.3.0-beta-0003 | 127 | 2/28/2024 |
3.2.4 | 1,715 | 2/3/2024 |
3.2.4-beta-0004 | 89 | 2/3/2024 |
3.2.4-beta-0002 | 96 | 2/2/2024 |
3.2.3 | 223 | 1/19/2024 |
3.2.2 | 723 | 1/3/2024 |
3.2.1 | 1,221 | 12/20/2023 |
3.2.0 | 315 | 12/11/2023 |
3.2.0-beta-0049 | 93 | 1/12/2024 |
3.2.0-beta-0042 | 119 | 1/3/2024 |
3.2.0-beta-0041 | 90 | 1/3/2024 |
3.2.0-beta-0034 | 99 | 12/20/2023 |
3.2.0-beta-0025 | 123 | 12/10/2023 |
3.2.0-beta-0022 | 146 | 11/29/2023 |
3.2.0-beta-0019 | 121 | 11/25/2023 |
3.2.0-beta-0010 | 131 | 11/11/2023 |
3.2.0-beta-0006 | 123 | 11/8/2023 |
3.1.2 | 793 | 11/8/2023 |
3.1.1 | 234 | 11/2/2023 |
3.1.0 | 528 | 10/27/2023 |
3.1.0-beta-0018 | 114 | 11/2/2023 |
3.1.0-beta-0007 | 130 | 10/17/2023 |
3.1.0-beta-0005 | 125 | 10/14/2023 |
3.1.0-beta-0004 | 104 | 10/14/2023 |
3.0.1 | 675 | 9/20/2023 |
3.0.1-beta-0016 | 123 | 9/20/2023 |
3.0.1-beta-0002 | 153 | 9/14/2023 |
3.0.0 | 737 | 9/5/2023 |
3.0.0-beta-0305 | 145 | 9/1/2023 |
3.0.0-beta-0301 | 127 | 8/31/2023 |
3.0.0-beta-0300 | 148 | 8/31/2023 |
3.0.0-beta-0296 | 138 | 8/28/2023 |
3.0.0-beta-0293 | 134 | 8/28/2023 |
3.0.0-beta-0292 | 139 | 8/28/2023 |
3.0.0-beta-0282 | 151 | 8/25/2023 |
3.0.0-beta-0277 | 169 | 8/20/2023 |
3.0.0-beta-0273 | 136 | 8/20/2023 |
3.0.0-beta-0257 | 159 | 8/15/2023 |
3.0.0-beta-0245 | 176 | 8/8/2023 |
3.0.0-beta-0241 | 360 | 7/31/2023 |
3.0.0-beta-0231 | 154 | 7/25/2023 |
3.0.0-beta-0230 | 154 | 7/25/2023 |
3.0.0-beta-0215 | 174 | 7/18/2023 |
3.0.0-beta-0210 | 393 | 7/12/2023 |
3.0.0-beta-0200 | 161 | 7/5/2023 |
3.0.0-beta-0199 | 162 | 7/5/2023 |
3.0.0-beta-0179 | 387 | 6/27/2023 |
3.0.0-beta-0174 | 165 | 6/26/2023 |
3.0.0-beta-0165 | 158 | 6/22/2023 |
3.0.0-beta-0154 | 170 | 6/17/2023 |
3.0.0-beta-0153 | 164 | 6/16/2023 |
3.0.0-beta-0124 | 566 | 6/1/2023 |
3.0.0-beta-0122 | 266 | 5/31/2023 |
3.0.0-beta-0116 | 155 | 5/30/2023 |
3.0.0-beta-0114 | 164 | 5/29/2023 |
3.0.0-beta-0092 | 202 | 5/16/2023 |
3.0.0-beta-0081 | 158 | 5/13/2023 |
3.0.0-beta-0073 | 153 | 5/12/2023 |
3.0.0-beta-0039 | 177 | 5/7/2023 |
3.0.0-beta-0031 | 153 | 5/5/2023 |
3.0.0-beta-0026 | 211 | 4/28/2023 |
3.0.0-beta-0023 | 168 | 4/26/2023 |
3.0.0-beta-0015 | 187 | 4/22/2023 |
3.0.0-beta-0001 | 289 | 4/14/2023 |
3.0.0-alpha-0608 | 139 | 4/13/2023 |
3.0.0-alpha-0604 | 150 | 4/13/2023 |
3.0.0-alpha-0593 | 223 | 4/7/2023 |
3.0.0-alpha-0560 | 1,199 | 3/28/2023 |
3.0.0-alpha-0557 | 158 | 3/27/2023 |
3.0.0-alpha-0552 | 162 | 3/26/2023 |
3.0.0-alpha-0550 | 164 | 3/25/2023 |
3.0.0-alpha-0548 | 158 | 3/25/2023 |
3.0.0-alpha-0545 | 164 | 3/25/2023 |
3.0.0-alpha-0543 | 180 | 3/24/2023 |
3.0.0-alpha-0540 | 156 | 3/24/2023 |
3.0.0-alpha-0533 | 4,370 | 3/14/2023 |
3.0.0-alpha-0532 | 163 | 3/12/2023 |
3.0.0-alpha-0530 | 253 | 3/6/2023 |
3.0.0-alpha-0523 | 210 | 3/1/2023 |
3.0.0-alpha-0516 | 173 | 2/27/2023 |
3.0.0-alpha-0513 | 140 | 2/26/2023 |
3.0.0-alpha-0497 | 147 | 2/23/2023 |
3.0.0-alpha-0496 | 664 | 2/4/2023 |
3.0.0-alpha-0495 | 670 | 1/12/2023 |
3.0.0-alpha-0491 | 377 | 12/24/2022 |
3.0.0-alpha-0489 | 179 | 12/23/2022 |
3.0.0-alpha-0470 | 171 | 12/15/2022 |
3.0.0-alpha-0427 | 284 | 12/4/2022 |
3.0.0-alpha-0423 | 178 | 12/1/2022 |
3.0.0-alpha-0402 | 328 | 11/19/2022 |
3.0.0-alpha-0399 | 251 | 11/12/2022 |
3.0.0-alpha-0396 | 167 | 11/12/2022 |
3.0.0-alpha-0392 | 214 | 10/29/2022 |
3.0.0-alpha-0391 | 180 | 10/27/2022 |
3.0.0-alpha-0387 | 329 | 10/25/2022 |
3.0.0-alpha-0384 | 196 | 10/25/2022 |
3.0.0-alpha-0376 | 185 | 10/7/2022 |
3.0.0-alpha-0370 | 183 | 10/4/2022 |
3.0.0-alpha-0360 | 154 | 10/3/2022 |
3.0.0-alpha-0354 | 193 | 10/1/2022 |
3.0.0-alpha-0348 | 212 | 9/26/2022 |
3.0.0-alpha-0344 | 182 | 9/25/2022 |
3.0.0-alpha-0343 | 171 | 9/24/2022 |
3.0.0-alpha-0338 | 178 | 9/22/2022 |
3.0.0-alpha-0329 | 161 | 9/20/2022 |
3.0.0-alpha-0310 | 221 | 9/3/2022 |
3.0.0-alpha-0283 | 179 | 8/24/2022 |
3.0.0-alpha-0266 | 208 | 8/13/2022 |
3.0.0-alpha-0245 | 188 | 8/10/2022 |
3.0.0-alpha-0225 | 200 | 8/9/2022 |
3.0.0-alpha-0216 | 177 | 8/7/2022 |
3.0.0-alpha-0208 | 192 | 8/5/2022 |
3.0.0-alpha-0204 | 171 | 7/31/2022 |
3.0.0-alpha-0181 | 190 | 7/25/2022 |
3.0.0-alpha-0172 | 164 | 7/22/2022 |
3.0.0-alpha-0167 | 205 | 7/19/2022 |
3.0.0-alpha-0160 | 187 | 7/18/2022 |
3.0.0-alpha-0158 | 183 | 7/18/2022 |
3.0.0-alpha-0157 | 192 | 7/17/2022 |
3.0.0-alpha-0156 | 177 | 7/16/2022 |
3.0.0-alpha-0155 | 195 | 7/15/2022 |
3.0.0-alpha-0142 | 167 | 7/14/2022 |
3.0.0-alpha-0128 | 217 | 6/16/2022 |
3.0.0-alpha-0102 | 181 | 6/6/2022 |
3.0.0-alpha-0099 | 181 | 6/2/2022 |
3.0.0-alpha-0090 | 184 | 5/25/2022 |
3.0.0-alpha-0087 | 180 | 5/24/2022 |
3.0.0-alpha-0084 | 180 | 5/24/2022 |
3.0.0-alpha-0082 | 195 | 5/23/2022 |
3.0.0-alpha-0079 | 177 | 5/21/2022 |
3.0.0-alpha-0075 | 197 | 5/20/2022 |
1.1.1 | 7,768 | 3/3/2022 |
1.0.0 | 242 | 5/27/2023 |