Trico 1.1.7

dotnet add package Trico --version 1.1.7
NuGet\Install-Package Trico -Version 1.1.7
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="Trico" Version="1.1.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Trico --version 1.1.7
#r "nuget: Trico, 1.1.7"
#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 Trico as a Cake Addin
#addin nuget:?package=Trico&version=1.1.7

// Install Trico as a Cake Tool
#tool nuget:?package=Trico&version=1.1.7

Trico

trico is a simple configuration library for your .net projects

Status

main Build Status
develop Build Status
unit tests Azure DevOps tests
version Nuget
downloads Nuget
license GitHub
size GitHub repo size

Supported providers

in-memory
file
environment variables
api
database

Usage

Step 1. Add Trico services to the service collection

You start with adding trico services to the IServiceCollection

serviceCollection.AddConfiguration();

Step 2. Configure required providers

Add required providers to the IServiceCollection.

Important! Configurations are looked up in providers in the order of registration in service collection.

In-Memory provider

In-Memory configuration provider is a non-persistent short-term storage. Used to work with configurations that are set and used in runtime. In coupe with other providers can also be used as a default application configuration
To add provider to your application, use:

serviceProvider.AddInMemoryProvider();

Initial set of configurations can be set by passing Dictionary<string, string> into the method:

Dictionary<string, string> defaultConfigs = GetDefaultConfigs();
serviceProvider.AddInMemoryProvider(defaultConfigs);
File provider

File configuration provider is a persistent long-term storage.
To add provider to your application, use:

serviceCollection.AddFileProvider();

Load params:

name description
config-filepath path to the file where configurations are stored
Environment variable provider

Environment variable configuration provider is a non-persistent long-term storage. Allows to import application configurations from environment variables, but can't update them.
To add provider to your application, use:

serviceCollection.AddEnvironmentVariableProvider();

Load params:

name description
prefix variable name prefix. Used to narrow down the scope of imported variables

Step 3. Explicitly load configurations

Load configurations either asynchronously:

Dictionary<string, string> options = new Dictionary<string, string>() {
    { "config-filepath", "..." },
    { "prefix", "" },
}
await config.LoadAsync(options, default);

Step 4. Use configurations

var value = config["key"];

More info

refer to the Playground project

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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. 
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.1.7 398 11/10/2023
1.1.5 350 5/24/2023
1.1.3 155 12/17/2022
1.1.2 151 12/17/2022