Phema.Configuration 3.0.0

C# strongly typed IConfiguration wrapper

Install-Package Phema.Configuration -Version 3.0.0
dotnet add package Phema.Configuration --version 3.0.0
<PackageReference Include="Phema.Configuration" Version="3.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Phema.Configuration --version 3.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Phema.Configuration, 3.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Phema.Configuration as a Cake Addin
#addin nuget:?package=Phema.Configuration&version=3.0.0

// Install Phema.Configuration as a Cake Tool
#tool nuget:?package=Phema.Configuration&version=3.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Phema.Configuration

Build Status Nuget

C# strongly typed IConfiguration wrapper

Installation

$> dotnet add package Phema.Configuration

Usage (or check for examples)

[Configuration]
public class RootConfiguration
{
  public InnerConfiguration Inner { get; set; }
}

[Configuration]
public class InnerConfiguration
{
}

// Add
var configuration = services.AddConfiguration<RootConfiguration>(Configuration);

// Get or inject with DI
var root = provider.GetRequiredService<IOptions<RootConfiguration>>().Value;
var inner = provider.GetRequiredService<IOptions<InnerConfiguration>>().Value;

Tips

  • To add configuration call AddConfiguration<T> on IServiceCollection
  • Mark all your configuration parts with ConfigurationAttribute to inclute in configuration tree
  • ConfigurationAttribute works both on type and property declaration
  • All configuration parts adds to IServiceCollection recursively. You can resolve them in app calling IServiceProvider or inject using DI

Phema.Configuration

Build Status Nuget

C# strongly typed IConfiguration wrapper

Installation

$> dotnet add package Phema.Configuration

Usage (or check for examples)

[Configuration]
public class RootConfiguration
{
  public InnerConfiguration Inner { get; set; }
}

[Configuration]
public class InnerConfiguration
{
}

// Add
var configuration = services.AddConfiguration<RootConfiguration>(Configuration);

// Get or inject with DI
var root = provider.GetRequiredService<IOptions<RootConfiguration>>().Value;
var inner = provider.GetRequiredService<IOptions<InnerConfiguration>>().Value;

Tips

  • To add configuration call AddConfiguration<T> on IServiceCollection
  • Mark all your configuration parts with ConfigurationAttribute to inclute in configuration tree
  • ConfigurationAttribute works both on type and property declaration
  • All configuration parts adds to IServiceCollection recursively. You can resolve them in app calling IServiceProvider or inject using DI

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
3.0.0 191 9/8/2019
3.0.0-preview3.0.2 210 4/12/2019
3.0.0-preview3.0.1 174 4/11/2019
3.0.0-preview3.0.0 172 3/30/2019