Kephas.Configuration
11.1.0
Prefix Reserved
dotnet add package Kephas.Configuration --version 11.1.0
NuGet\Install-Package Kephas.Configuration -Version 11.1.0
<PackageReference Include="Kephas.Configuration" Version="11.1.0" />
paket add Kephas.Configuration --version 11.1.0
#r "nuget: Kephas.Configuration, 11.1.0"
// Install Kephas.Configuration as a Cake Addin #addin nuget:?package=Kephas.Configuration&version=11.1.0 // Install Kephas.Configuration as a Cake Tool #tool nuget:?package=Kephas.Configuration&version=11.1.0
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 | Versions 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. |
-
.NETStandard 2.1
- Kephas.Abstractions (>= 11.1.0)
- Kephas.Injection (>= 11.1.0)
- Kephas.Interaction (>= 11.1.0)
- Kephas.Operations (>= 11.1.0)
- Kephas.Reflection (>= 11.1.0)
- Kephas.Serialization (>= 11.1.0)
-
net6.0
- Kephas.Abstractions (>= 11.1.0)
- Kephas.Injection (>= 11.1.0)
- Kephas.Interaction (>= 11.1.0)
- Kephas.Operations (>= 11.1.0)
- Kephas.Reflection (>= 11.1.0)
- Kephas.Serialization (>= 11.1.0)
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,568 | 4/13/2022 |
11.1.0-dev.4 | 156 | 4/6/2022 |
11.1.0-dev.3 | 146 | 3/30/2022 |
11.1.0-dev.2 | 156 | 3/23/2022 |
11.1.0-dev.1 | 137 | 3/23/2022 |
11.0.0 | 12,984 | 3/11/2022 |
11.0.0-dev.7 | 154 | 3/7/2022 |
11.0.0-dev.6 | 145 | 2/28/2022 |
11.0.0-dev.5 | 133 | 2/26/2022 |
11.0.0-dev.4 | 146 | 2/24/2022 |
11.0.0-dev.3 | 152 | 2/23/2022 |
11.0.0-dev.2 | 149 | 2/18/2022 |
11.0.0-dev.1 | 146 | 2/7/2022 |
10.3.0 | 9,444 | 1/18/2022 |
10.2.0 | 5,875 | 12/3/2021 |
10.1.0 | 9,848 | 11/23/2021 |
10.1.0-dev.7 | 210 | 11/17/2021 |
10.1.0-dev.6 | 189 | 11/16/2021 |
10.1.0-dev.5 | 178 | 11/10/2021 |
10.1.0-dev.4 | 196 | 11/8/2021 |
10.1.0-dev.3 | 160 | 11/8/2021 |
10.1.0-dev.2 | 175 | 11/4/2021 |
10.1.0-dev.1 | 172 | 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.