NuGet ยท nuget

microsoft.extensions.configuration.abstractions

Cached from upstream

Install

Install-Kommandos

dotnet add package microsoft.extensions.configuration.abstractions --version 10.0.0
<PackageReference Include="microsoft.extensions.configuration.abstractions" Version="10.0.0" />
paket add microsoft.extensions.configuration.abstractions --version 10.0.0
Install-Package microsoft.extensions.configuration.abstractions -Version 10.0.0

README

Vorschau

About

<!-- A description of the package and where one can find more documentation -->

Provides abstractions of key-value pair based configuration. Interfaces defined in this package are implemented by classes in Microsoft.Extensions.Configuration and other configuration packages.

Key Features

<!-- The key features of this package -->

  • Abstractions for string key-value pair configuration sources and sections
  • Path conventions of keys establishing a heirachy of values
  • Support for multiple configuration sources, aggregating and defining precdence for values
  • Support for reload on change

How to Use

<!-- A compelling example on how to use this package with code, as well as any specific guidelines for when to use the package -->

The example below shows a small code sample using this library and trying out the ConfigurationKeyName attribute available since .NET 6:

public class MyClass
{
    [ConfigurationKeyName("named_property")]
    public string NamedProperty { get; set; }
}

Given the simple class above, we can create a dictionary to hold the configuration data and use it as the memory source to build a configuration section:

var dic = new Dictionary<string, string>
{
    {"named_property", "value for named property"},
};

var config = new ConfigurationBuilder()
    .AddInMemoryCollection(dic)
    .Build();

var options = config.Get<MyClass>();
Console.WriteLine(options.NamedProperty); // returns "value for named property"

Main Types

<!-- The main types provided in this library -->

The main types provided by this library are:

  • Microsoft.Extensions.Configuration.IConfiguration
  • Microsoft.Extensions.Configuration.IConfigurationBuilder
  • Microsoft.Extensions.Configuration.IConfigurationProvider
  • Microsoft.Extensions.Configuration.IConfigurationRoot
  • Microsoft.Extensions.Configuration.IConfigurationSection

Additional Documentation

<!-- Links to further documentation -->

<!-- The related packages associated with this package -->

Feedback & Contributing

<!-- How to provide feedback on this package and contribute to it -->

Microsoft.Extensions.Caching.Abstractions is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.