ParametrizedConfiguration 1.0.0
See the version list below for details.
dotnet add package ParametrizedConfiguration --version 1.0.0
NuGet\Install-Package ParametrizedConfiguration -Version 1.0.0
<PackageReference Include="ParametrizedConfiguration" Version="1.0.0" />
<PackageVersion Include="ParametrizedConfiguration" Version="1.0.0" />
<PackageReference Include="ParametrizedConfiguration" />
paket add ParametrizedConfiguration --version 1.0.0
#r "nuget: ParametrizedConfiguration, 1.0.0"
#addin nuget:?package=ParametrizedConfiguration&version=1.0.0
#tool nuget:?package=ParametrizedConfiguration&version=1.0.0
ParametrizedConfiguration
ParametrizedConfiguration library presents a configuration provider that uses it`s own configuration data via other providers to parametrize parameter placeholders with values, accessed by parameter keys. By default placeholders defined between two %
symbols like %param name%
, where param name
should be the key of the same configuration, the value of which will be substituted into %param name%
. for example:
This configuration:
{
{ "param1", "1+%param2%" },
{ "param2", "2+%param3%" },
{ "param3", "3" }
};
will be parametrized into this:
{
{ "param1", "1+2+3" },
{ "param2", "2+3" },
{ "param3", "3" }
};
This can be used to hide sensitive data from publicly stored configurations or to reuse same configuration values in several places. The code below demonstrates this:
using ParametrizedConfiguration; using Microsoft.Extensions.Configuration; // Assume secrets are set via environment variables somewere outside this code, // we set them here just for clarity: Environment.SetEnvironmentVariable("DatabaseName", "MyDatabase"); Environment.SetEnvironmentVariable("UserName", "Bob"); Environment.SetEnvironmentVariable("Password", "strongPassword"); // Define configuration that will be parametrized with it`s own values: var configuration = new ConfigurationBuilder() .AddEnvironmentVariables() .WithParametrization() .Build(); // Let`s define our configuration key with parameters. It also won't be here // in our production code, but will be loaded from configuration providers // such as json-files or any other defined in ConfigurationBuilder. configuration["ConnectionStrings:Mssql"] = "Server=mssql-server;Database=%DatabaseName%;User Id=%UserName%;Password=%Password%;TrustServerCertificate=True"; // Ok, now let`s get the connection string from configuration: Console.WriteLine(configuration.GetConnectionString("mssql")); // Output will be parametrized with values from same configuration: // Server=mssql-server;Database=MyDatabase;User Id=Bob;Password=strongPassword;TrustServerCertificate=True
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- ConfigurationRepository (>= 1.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ParametrizedConfiguration:
Package | Downloads |
---|---|
ConfigurationRepository.Dapper
Configuration repository provider that stored in a database and accessed via Dapper ORM. |
GitHub repositories
This package is not used by any popular GitHub repositories.