CodedThought.Core.Configuration
10.0.2
See the version list below for details.
dotnet add package CodedThought.Core.Configuration --version 10.0.2
NuGet\Install-Package CodedThought.Core.Configuration -Version 10.0.2
<PackageReference Include="CodedThought.Core.Configuration" Version="10.0.2" />
<PackageVersion Include="CodedThought.Core.Configuration" Version="10.0.2" />
<PackageReference Include="CodedThought.Core.Configuration" />
paket add CodedThought.Core.Configuration --version 10.0.2
#r "nuget: CodedThought.Core.Configuration, 10.0.2"
#:package CodedThought.Core.Configuration@10.0.2
#addin nuget:?package=CodedThought.Core.Configuration&version=10.0.2
#tool nuget:?package=CodedThought.Core.Configuration&version=10.0.2
CodedThought.Core.Configuration
A .NET Core Configuration manager to use with the CodedThought.Core framework or alone with any other .NET Core project
Usage of the CodedThought.Core.Configuration library is done with a few extension methods.
Installation and Usage
- Reference the package in Nuget.
- To add a reference to the standard .NET appSettings.json simply call the
AddAppSettingsConfigurationextension method off of the builder class. - To add an additional set of custom settings outside of the appSettings.json file.
- Create your own .json configuration file alongside the appsettings.json file. It should follow the appsettings.json JSON format.
- Add the
AddCoreSettingsConfigurationextension method off of the app builder. You may choose to use the default ctSettings.json file name or provide your own.
- All methods support passing in the current environment to enable environment specific settings.
- Register the settings with
AddCoreSettingsso the section is bound once and validated when the host starts.
builder.Configuration.AddCoreSettingsConfiguration(env: builder.Environment, optional: false, reloadOnChange: true);
builder.Services.AddCoreSettings(builder.Configuration);
Configuration Sources
AddCoreSettingsConfiguration adds, in order, the settings file, the optional ctSettings.{Environment}.json overlay, and the environment variables. Pass includeEnvironmentVariables: false to omit the last source. The optional and reloadOnChange arguments are applied to the base settings file; the environment overlay is always optional.
Connection Accessors
| Method | Description & Remarks |
|---|---|
| GetCoreSettings() | Binds the CoreSettings section into a new instance. |
| GetCorePrimaryConnection() | Returns the connection marked Primary=true, or null when none is marked. |
| GetDatabaseConnection(name) | Returns the connection matching the name, or null when absent. Matching ignores case. |
| GetRequiredCorePrimaryConnection() | Returns the primary connection, throwing an InvalidOperationException that lists the configured connections when none is marked. |
| GetRequiredDatabaseConnection(name) | Returns the named connection, throwing an InvalidOperationException that lists the configured connections when absent. |
| GetCoreDatabaseProviders() | Returns the distinct ProviderType values across all configured connections. |
Startup Validation
CoreSettingsValidator runs through ValidateOnStart() and reports every failure at once. It rejects a section with no connections, a connection count of Primary=true other than exactly one, duplicate connection names, a blank Name or ConnectionString, a negative Timeout, and any ProviderType outside SqlServer, Oracle, MongoDb, OleDb, MySql, ApiServer, and PostgreSQL.
Release Notes
| Feature | Description & Remarks |
|---|---|
| Options Pattern | AddCoreSettings(IConfiguration) binds the CoreSettings section through IOptions<CoreSettings> and validates it with ValidateOnStart(). Inject IOptionsMonitor<CoreSettings> to observe settings-file changes, or IOptionsSnapshot<CoreSettings> for a value fixed for the lifetime of a request. |
| Required Connection Accessors | Breaking. GetCorePrimaryConnection and GetDatabaseConnection now return a nullable ConnectionSetting, matching their actual behavior. Use the GetRequired* companions where a missing connection should throw. |
| Environment Variable Overlay | The AddCoreSettingsConfiguration overloads now honor their optional and reloadOnChange arguments, always add the optional ctSettings.{Environment}.json overlay, and append the environment variable provider by default so secrets can be supplied from the environment. |
| Case-Insensitive Settings | CoreSettings.Settings is matched without regard to case through the new TryGetSetting and GetSetting methods. ApplicationCookieName resolves regardless of its position in the file. |
| WINFORM Setting Removed | Breaking. The WINFORM setting and the CoreSettings.IsWinForm property are removed. |
| Validation Messages | Breaking. ValidationConfigurationProvider implements the new IValidationMessageProvider instead of IConfigurationProvider. Register it with AddCoreValidationMessages(IConfiguration). Absent or blank keys fall back to the built-in defaults. |
| CoreSettingsRoot Removed | Breaking. The unused CoreSettingsRoot wrapper and the ValidationMessageElement type are removed. |
| Provider Validation Fixed | ConnectionSetting.CheckProvider() no longer throws for valid providers. Supported types are exposed through ConnectionSetting.SupportedProviders. |
| Dependency Cleanup | The Newtonsoft.Json reference is removed and Microsoft.Extensions.Hosting is narrowed to Hosting.Abstractions. Package versions are managed centrally from the root Directory.Packages.props. |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Microsoft.Extensions.Configuration (>= 10.0.13)
- Microsoft.Extensions.Configuration.Json (>= 10.0.13)
- Microsoft.Extensions.Hosting (>= 10.0.13)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.13)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on CodedThought.Core.Configuration:
| Package | Downloads |
|---|---|
|
CodedThought.Core
The CodedThought.Core library is a custom entity framework used to primarily abstract the database away from consuming components or clients. |
|
|
CodedThought.Core.Data.PostGreSQL
The CodedThought.Core.Data.PostGreSQL package is a custom database provider for use with PostgreSQL. |
|
|
CodedThought.Core.Data.OleDb
The CodedThought.Core.Data.OleDb package is a custom database provider for use with OleDb Compatible Server. |
|
|
CodedThought.Core.Data.Sybase
The CodedThought.Core.Data.Sybase package is a custom database provider for use with a Sybase Server. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.3 | 58 | 10/22/2026 |
| 10.0.2 | 43 | 10/22/2026 |
| 10.0.1 | 368 | 4/27/2026 |
| 10.0.0-alpha-1 | 530 | 11/18/2025 |
| 8.0.1.2 | 627 | 8/29/2025 |
| 8.0.1.1 | 529 | 3/21/2025 |
| 8.0.1 | 1,446 | 11/4/2024 |
| 8.0.0-rc.1 | 189 | 11/4/2024 |
| 8.0.0-beta-9 | 340 | 8/29/2024 |
| 8.0.0-beta-8 | 212 | 8/1/2024 |
| 8.0.0-beta-5 | 303 | 6/13/2024 |
| 6.0.0.7 | 588 | 10/26/2023 |
Upgraded to .NET 10