NuGet ยท nuget

Redeon.SuperSiteEngineCore.Web.Eltheon.Core.ConfigFiles

Core ConfigFile-Types for Eltheon Framework

Install

Install-Kommandos

dotnet add package Redeon.SuperSiteEngineCore.Web.Eltheon.Core.ConfigFiles --version 2.9.9.1
<PackageReference Include="Redeon.SuperSiteEngineCore.Web.Eltheon.Core.ConfigFiles" Version="2.9.9.1" />
paket add Redeon.SuperSiteEngineCore.Web.Eltheon.Core.ConfigFiles --version 2.9.9.1
Install-Package Redeon.SuperSiteEngineCore.Web.Eltheon.Core.ConfigFiles -Version 2.9.9.1

README

Vorschau

Redeon.SuperSiteEngineCore.Web.Eltheon.Core.ConfigFiles

Overview

This package manages hierarchical configuration for Eltheon. It contains base config file abstractions, serializers, discovery helpers, and the extension methods used by GlobalConfig to load strongly typed configuration objects.

Normal hosts connect ConfigFiles to the configs system space before host composition. Reads prefer Storage and fall back per object to the legacy Configs directory only when the Storage object is absent. Writes use the Storage pipeline exclusively and never recreate a deleted legacy Configs directory. Installer hosts without Storage retain atomic legacy writes.

Capabilities

  • BaseConfigFile<T> handles JSON persistence (with polymorphic support) and path management using GlobalConfig.
  • ConfigContentStore provides safe relative object-key access for Configs.json, DatabaseConfig.json, Languages.json, and Services/*.json, including source diagnostics for Storage and Legacy.
  • ConfigsFile keeps a list of discovered IConfig implementations. GlobalConfig.Configs() bootstraps this file and scans all loaded assemblies for classes implementing IConfig.
  • ConfigsFile.SaveConfig(Type, IConfig) atomically merges only the changed configuration. Existing JSON tokens for unchanged or temporarily unavailable configurations remain untouched.
  • Extension methods like GlobalConfig.GetConfig<T>() allow any feature to fetch its config payload without knowing the storage layout.
  • ConfigOptionsProviderAttribute, IConfigOptionsProvider, and IConfigOptionsResolver provide dynamic option metadata for admin configuration fields without hard-coding feature-specific select lists in the UI.
  • ConfigCollectionItemProviderAttribute, ConfigCollectionItemDescriptor, IConfigCollectionItemProvider, and IConfigCollectionItemResolver describe concrete item types for polymorphic collections such as List<TBase> or List<TInterface>.
  • AddConfigsStore() registers ConfigFiles-owned canonical event metadata, dynamic option resolution, and polymorphic collection item resolution for safe configuration and template-owned database configuration signals.

Usage

  1. Resolve paths with GlobalConfig.Initialize(path, ensureDirectories: false) for normal runtime hosts. Installer hosts may explicitly pass true.
  2. Create a class implementing IConfig and place it in any loaded assembly.
  3. Add dynamic field options with [ConfigOptionsProvider(typeof(MyProvider))] when a property should render from runtime-provided choices.
  4. Add polymorphic collection item choices with [ConfigCollectionItemProvider(typeof(MyItemProvider))] when a list uses an abstract base type or interface and the admin UI must offer concrete item types.
  5. Call GlobalConfig.Instance.Configs().Load() (or the provided extensions) to populate the config list, then query it via GetConfig<T>().

Notes

  • The package uses Newtonsoft.Json with TypeNameHandling.Auto to persist polymorphic trigger/config types. Do not remove type metadata unless you control all config consumers.
  • JSON deserialization replaces initialized collection instances instead of appending into them. This prevents default list values from being duplicated on repeated load/save cycles.
  • Dynamic option providers and collection item providers are resolved from DI first and fall back to activator-based construction where possible.
  • Collection item descriptors are filtered against the declared collection element type. Disabled or incompatible descriptors must not create posted items.
  • Because the extension scans every loaded assembly, keep config classes lightweight to avoid large static initialization costs at startup.
  • Configuration/data events never include raw values, secrets, or connection strings. Payloads carry config names, changed keys, provider/context names, redaction flags, and generic reason codes only.
  • A corrupt or unreadable Storage object is never masked by a legacy object. Storage write failures never fall back to Legacy.