Kephas.Configuration 11.1.0-dev.3

Prefix Reserved
This is a prerelease version of Kephas.Configuration.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Kephas.Configuration --version 11.1.0-dev.3                
NuGet\Install-Package Kephas.Configuration -Version 11.1.0-dev.3                
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="Kephas.Configuration" Version="11.1.0-dev.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Kephas.Configuration --version 11.1.0-dev.3                
#r "nuget: Kephas.Configuration, 11.1.0-dev.3"                
#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 Kephas.Configuration as a Cake Addin
#addin nuget:?package=Kephas.Configuration&version=11.1.0-dev.3&prerelease

// Install Kephas.Configuration as a Cake Tool
#tool nuget:?package=Kephas.Configuration&version=11.1.0-dev.3&prerelease                

Configuration

The IConfiguration<TSettings> service

While the application configuration should be fine for most cases, when working very strictly component oriented it would be more appropriate to access a configuration targeted to that component, if possible injected through composition. This is possible through the IConfiguration<TSettings> [[shared application service|Application-Services]].

  • This service is itself an [[expando|Expando]] object, where values may be dynamically added.
  • Provides the Settings: TSettings property, which returns the settings of the specified type.

Example of usage:


    // Settings class (DTO). Inherit from the ISettings marker interface to make the settings discoverable over metadata. 

    public class ConsoleSettings : ISettings
    {
        public string ForeColor { get; set; }

        public string BackColor { get; set; }
    }

    // Class consuming IConfiguration<ConsoleSettings>.

    public class ConsoleFeatureManager : FeatureManagerBase
    {
        private readonly IConfiguration<ConsoleSettings> consoleConfig;

        public ConsoleFeatureManager(IConfiguration<ConsoleSettings> consoleConfig)
        {
            this.consoleConfig = consoleConfig;
        }

        /// <summary>Initializes the feature asynchronously.</summary>
        /// <param name="appContext">Context for the application.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>A Task.</returns>
        protected override async Task InitializeCoreAsync(IAppContext appContext, CancellationToken cancellationToken)
        {
            Console.BackgroundColor = Enum.Parse<ConsoleColor>(this.consoleConfig.Settings.BackColor);
            Console.ForegroundColor = Enum.Parse<ConsoleColor>(this.consoleConfig.Settings.ForeColor);
        }
    }

The Configuration<TSettings> service implementation

This service implementation is the default for the IConfiguration<TSettings> service contract. It is designed to be truly flexible in providing settings of a specific type, by aggregating configuration providers aimed at specific settings types and to which it delegates the settings retrieval. To summarize the flow:

  • Gets the configuration providers ordered by their [[override|Application-Services#override-priority]] and [[processing priority|Application-Services#processing-priority]].
  • Tries to find a provider handling that specific settings type. If none found, then it looks for another provider handling a compatible settings type. If still none found, then attempts to find one handling all settings types. If still none found, a NotSupportedException occurs.
  • Delegates the settings retrieval to that provider.
  • Caches the settings for faster later use.

Configuration providers

As described previously, the configuration providers are used to provide settings of a specific type. They are completely free in choosing the proper implementation. A fallback provider is the AppConfigurationProvider, which is registered for all settings type, however with the lowest priority, and which gets the settings from the IAppConfiguration service.

A configuration provider:

  • declares the handled settings type over the [SettingsType(type)] attribute.
  • provides the settings through the GetSettings(settingsType: Type): object method.

Another typical configuration provider would be a file based one, for example JSON or XML.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (15)

Showing the top 5 NuGet packages that depend on Kephas.Configuration:

Package Downloads
Kephas.Core

Aggregates the most used Kephas infrastructure to provide a . Typically used areas and classes/interfaces/services: - AmbientServices - Data: IIdGenerator, DefaultIdGenerator. Kephas Framework ("stone" in aramaic) aims to deliver a solid infrastructure for applications and application ecosystems.

Kephas.Model

Provides an abstract multi-dimensional modeling infrastructure, containing extensible model elements like dimensions, classifiers, and value types. Typically used areas and classes/interfaces/services: - IModelSpace, IClassifier, IAnnotation, IProperty, IMethod, IParameter. - AttributedModel: AbstractAttribute, AspectAttribute, AspectForAttribute, MixinAttribute, ValueTypeAttribute. Kephas Framework ("stone" in aramaic) aims to deliver a solid infrastructure for applications and application ecosystems.

Kephas.Application

Provides an abstract infrastructure for applications based on Kephas Framework. Typically used areas and classes/interfaces/services: - AppBase, IAppContext. - IAppManager, DefaultAppManager. - IFeatureManager, FeatureManagerBase. - Interaction: FeatureStartedEvent, FeatureStartingEvent, FeatureStoppedEvent, FeatureStoppingEvent. - Configuration: SystemSettings, AppSettings, HostSettings. Kephas Framework ("stone" in aramaic) aims to deliver a solid infrastructure for applications and application ecosystems.

Kephas.Mail.MailKit

Provides the mailing services implementation using MailKit. Typically used areas and classes/interfaces/services: - Services: MailKitEmailSenderServiceBase, SystemMailKitEmailSenderService. Kephas Framework ("stone" in aramaic) aims to deliver a solid infrastructure for applications and application ecosystems.

Kephas.Extensions.Configuration

Provides the configuration implementation using the Microsoft.Extensions.Configuration components. Typically used areas and classes/interfaces/services: - IAmbientServices.UseConfiguration(). Kephas Framework ("stone" in aramaic) aims to deliver a solid infrastructure for applications and application ecosystems.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
11.1.0 13,456 4/13/2022
11.1.0-dev.4 153 4/6/2022
11.1.0-dev.3 143 3/30/2022
11.1.0-dev.2 153 3/23/2022
11.1.0-dev.1 134 3/23/2022
11.0.0 12,977 3/11/2022
11.0.0-dev.7 149 3/7/2022
11.0.0-dev.6 142 2/28/2022
11.0.0-dev.5 130 2/26/2022
11.0.0-dev.4 143 2/24/2022
11.0.0-dev.3 149 2/23/2022
11.0.0-dev.2 146 2/18/2022
11.0.0-dev.1 143 2/7/2022
10.3.0 9,423 1/18/2022
10.2.0 5,868 12/3/2021
10.1.0 9,841 11/23/2021
10.1.0-dev.7 207 11/17/2021
10.1.0-dev.6 186 11/16/2021
10.1.0-dev.5 173 11/10/2021
10.1.0-dev.4 193 11/8/2021
10.1.0-dev.3 157 11/8/2021
10.1.0-dev.2 170 11/4/2021
10.1.0-dev.1 169 11/3/2021

Please check https://github.com/kephas-software/kephas/releases for the change log.
           Also check the documentation and the samples from https://github.com/kephas-software/kephas/wiki and https://github.com/kephas-software/kephas/tree/master/Samples.