NimbleConfig.DependencyInjection.Aspnetcore 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package NimbleConfig.DependencyInjection.Aspnetcore --version 1.0.0                
NuGet\Install-Package NimbleConfig.DependencyInjection.Aspnetcore -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NimbleConfig.DependencyInjection.Aspnetcore" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NimbleConfig.DependencyInjection.Aspnetcore --version 1.0.0                
#r "nuget: NimbleConfig.DependencyInjection.Aspnetcore, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NimbleConfig.DependencyInjection.Aspnetcore as a Cake Addin
#addin nuget:?package=NimbleConfig.DependencyInjection.Aspnetcore&version=1.0.0

// Install NimbleConfig.DependencyInjection.Aspnetcore as a Cake Tool
#tool nuget:?package=NimbleConfig.DependencyInjection.Aspnetcore&version=1.0.0                

NimbleConfig

A simple, unambitious, convention-based configuration injector for .net with support for AspNetCore using IConfiguration (Microsoft.Extensions.Configuration)


Using it is very easy

  1. Install Nuget NimbleConfig.DependencyInjection.Aspnetcore (Or download source from here and reference it)

  2. Define your settings class as follows

    // Our setting is a string
    public class SomeSetting: ConfigurationSetting<string>
    {
    }
  1. Add it to your appsettings.json
    {
        "SomeSetting": "SomeValue"
    }
  1. Inject and use it in your controllers, services etc
    public class ValuesController : ControllerBase
    {
        private readonly SomeSetting _someSetting;

        public ValuesController(SomeSetting someSetting)
        {
            _someSetting = someSetting;
        }
		
        public ActionResult<IEnumerable<string>> Get()
        {
            return new string[] { 
                "value1",
                "value2",
                _someSetting.Value
            };
        }
    }
  1. In the ConfigureServices() method in your Startup.cs add the following to scan and inject settings types
    public void ConfigureServices(IServiceCollection services)
    {
        // Other services go here
		
        var assemblies = new[] {typeof(Startup).Assembly}; // assemblies to scan for settings
        services.AddConfigurationSettingsFrom(assemblies); // Wire it up
    }

See the sample project more advanced use cases like custom naming, complex types and arrays.


Feel free to contribute and raise issues as you see fit 😃

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.29 8,231 6/18/2020
1.0.27 2,263 4/7/2019
1.0.24 1,211 8/11/2018
1.0.23 793 8/7/2018
1.0.22 783 8/4/2018
1.0.21 836 8/2/2018
1.0.19 783 7/31/2018
1.0.15 828 7/30/2018
1.0.14 774 7/29/2018
1.0.13 812 7/28/2018
1.0.12 780 7/27/2018
1.0.11 767 7/26/2018
1.0.10 783 7/25/2018
1.0.8 793 7/24/2018
1.0.7 830 7/23/2018
1.0.6 818 7/23/2018
1.0.5 824 7/23/2018
1.0.0 827 7/22/2018