Chakra.Core.Configurations 2.0.15

Configuration extensions for Chakra.Core

There is a newer version of this package available.
See the version list below for details.
Install-Package Chakra.Core.Configurations -Version 2.0.15
dotnet add package Chakra.Core.Configurations --version 2.0.15
<PackageReference Include="Chakra.Core.Configurations" Version="2.0.15" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Chakra.Core.Configurations --version 2.0.15
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Chakra.Core.Configurations

Configuration extensions for Chakra.Core

Please checkout README.md on "Chakra.Core" package, first...
Then:

  1. Define your own application configuration implementation class like that:
public class ApplicationConfiguration : IApplicationConfigurationRoot
{
    public string EnvironmentName { get; set; }

    public string ApiKey { get; set; }

    public IList<SampleServiceSetting> Services { get; set; }
}

public class SampleServiceSetting
{
    public string Name { get; set; }
    public string BaseUrl{ get; set; }
}
  1. Insert your appsettings.json file on application root folder with flag 'Copy to output directory' set to 'Copy always'.
    Note that configuration works also with ASP.NET environments with value retrived from 'ASPNETCORE_ENVIRONMENT' environment
    variable (ex. 'appsettings.Development.json', 'appsettings.Production.json', 'appsettings.[Environment Name].json').

  2. Get configuration value using strongly-typed class with singleton instance like that:

var apiKey = ConfigurationFactory<ApplicationConfiguration>.Instance.ApiKey;
var enviromentName = ConfigurationFactory<ApplicationConfiguration>.Instance.EnvironmentName;

NOTE: For unit testing purpose, you can also "force" a specific configuration without
providing appsettings.json file. Just do the following on unit test initialize:

ConfigurationFactory<ApplicationConfiguration>.Set(new ApplicationConfiguration{ ... });

Chakra.Core.Configurations

Configuration extensions for Chakra.Core

Please checkout README.md on "Chakra.Core" package, first...
Then:

  1. Define your own application configuration implementation class like that:
public class ApplicationConfiguration : IApplicationConfigurationRoot
{
    public string EnvironmentName { get; set; }

    public string ApiKey { get; set; }

    public IList<SampleServiceSetting> Services { get; set; }
}

public class SampleServiceSetting
{
    public string Name { get; set; }
    public string BaseUrl{ get; set; }
}
  1. Insert your appsettings.json file on application root folder with flag 'Copy to output directory' set to 'Copy always'.
    Note that configuration works also with ASP.NET environments with value retrived from 'ASPNETCORE_ENVIRONMENT' environment
    variable (ex. 'appsettings.Development.json', 'appsettings.Production.json', 'appsettings.[Environment Name].json').

  2. Get configuration value using strongly-typed class with singleton instance like that:

var apiKey = ConfigurationFactory<ApplicationConfiguration>.Instance.ApiKey;
var enviromentName = ConfigurationFactory<ApplicationConfiguration>.Instance.EnvironmentName;

NOTE: For unit testing purpose, you can also "force" a specific configuration without
providing appsettings.json file. Just do the following on unit test initialize:

ConfigurationFactory<ApplicationConfiguration>.Set(new ApplicationConfiguration{ ... });

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.3 101 7/2/2020
3.0.2 468 3/24/2020
3.0.1 110 3/23/2020
3.0.0 255 1/31/2020
2.0.15 1,681 10/24/2019
2.0.13 2,145 11/21/2018
2.0.12 221 11/21/2018
2.0.11 248 10/30/2018
2.0.10 462 7/17/2018