init
This commit is contained in:
56
docs/ai/Common/DTS.Common.Core/Config.md
Normal file
56
docs/ai/Common/DTS.Common.Core/Config.md
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Core/Config/DTSConfig.cs
|
||||
generated_at: "2026-04-17T16:08:08.424741+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "20e6632b3b560005"
|
||||
---
|
||||
|
||||
# Config
|
||||
|
||||
### Purpose
|
||||
Provides centralized, thread-safe access to an alternate configuration file for the application. This module exists to allow the system to read settings and configuration sections from a dynamically-specified config file path rather than the default application configuration, supporting scenarios where configuration needs to be externalized or swapped at runtime.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**`DTSConfig` (static class)**
|
||||
|
||||
- `static void DTSConfigInit(string path)` — Initializes the configuration system with the specified config file path. Internally calls `SetAltConfigPath`.
|
||||
|
||||
- `static void AltConfigPathSet(string path)` — Thread-safe setter for the alternate config file path. Acquires lock on `MyLock` before assigning.
|
||||
|
||||
- `static string AltConfigPathGet()` — Thread-safe getter for the alternate config file path. Acquires lock on `MyLock` before returning.
|
||||
|
||||
- `static void SetAltConfigPath(string path)` — Sets the alternate config path and opens the mapped configuration file. If `path` is null or empty, falls back to `DTSConstants.CustomConfigPath`. Creates a new `Configuration` object via `ConfigurationManager.OpenMappedExeConfiguration`.
|
||||
|
||||
- `static Configuration GetAltConfig()` — Thread-safe getter returning the current `Configuration` object for the alternate config file.
|
||||
|
||||
- `static string GetAppSetting(string key)` — Retrieves an app setting value by key from the alternate configuration. Returns `string.Empty` if the key is not found (logs a message via `APILogger.Log` in that case).
|
||||
|
||||
- `static object GetSection(string sectionName)` — Retrieves a configuration section by name from the alternate configuration. Returns `null` if the section is not found (logs a message via `APILogger.Log` in that case).
|
||||
|
||||
### Invariants
|
||||
|
||||
- All access to static fields (`AltConfigPath`, `AltConfig`) is protected by a lock on `MyLock` for thread safety.
|
||||
- `SetAltConfigPath` must be called before `GetAppSetting` or `GetSection` can return meaningful results; otherwise, `AltConfig` may be null.
|
||||
- `GetAppSetting` always returns a non-null string (empty string if key not found).
|
||||
- `GetSection` may return null if the section does not exist.
|
||||
|
||||
### Dependencies
|
||||
|
||||
**Depends on:**
|
||||
- `DTS.Common.Utilities.Logging` (uses `APILogger.Log`)
|
||||
- `System.Configuration` (uses `Configuration`, `ConfigurationManager`, `ExeConfigurationFileMap`, `KeyValueConfigurationElement`, `ConfigurationUserLevel`)
|
||||
- `DTSConstants.CustomConfigPath` (referenced constant, defined elsewhere in the codebase)
|
||||
|
||||
**Dependents:** Unknown from source alone.
|
||||
|
||||
### Gotchas
|
||||
|
||||
- The static constructor is empty, meaning `AltConfig` is not initialized until `SetAltConfigPath` is explicitly called. Calling `GetAppSetting` or `GetSection` before initialization will result in a `NullReferenceException`.
|
||||
- `DTSConfigInit` and `SetAltConfigPath` appear to be redundant; `DTSConfigInit` simply delegates to `SetAltConfigPath` with no additional logic.
|
||||
- `AltConfigPathGet` and `AltConfigPathSet` are separate methods rather than a property, which is unconventional for C#.
|
||||
- The `GetAppSetting` method uses LINQ to cast and search settings, which is less efficient than using the `AppSettings.Settings[key]` indexer, but handles the case where the key might not exist gracefully.
|
||||
|
||||
---
|
||||
31
docs/ai/Common/DTS.Common.Core/EventManager.md
Normal file
31
docs/ai/Common/DTS.Common.Core/EventManager.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Core/EventManager/EventManager.cs
|
||||
generated_at: "2026-04-17T16:08:08.426285+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "1537aca27bc7a4d4"
|
||||
---
|
||||
|
||||
# EventManager
|
||||
|
||||
### Purpose
|
||||
Implements a lightweight, in-process publish/subscribe event system that allows components to communicate without direct coupling. Publishers emit events by type, and subscribers register callbacks to receive specific event types, optionally with filtering predicates. The module also supports diagnostic listeners for monitoring event system activity.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**`SubscriberCallbackDelegate<in T>` (delegate)**
|
||||
- `void SubscriberCallbackDelegate<in T>(T item) where T : class` — Delegate signature for event listeners.
|
||||
|
||||
**`DiagnosticCallbackDelegate` (delegate)**
|
||||
- `void DiagnosticCallbackDelegate(EventDiagnosticType eventType, Type t, object eventData, string listener)` — Delegate signature for diagnostic event listeners.
|
||||
|
||||
**`EventManager` (static class)**
|
||||
|
||||
- `static void Publish<T>(T eventData) where T : class` — Publishes an event to all subscribers of type `T`. If no subscribers exist for the type, returns immediately. For each subscriber, evaluates the `EventFilter` predicate (if present) before invoking the callback.
|
||||
|
||||
- `static void Subscribe<T>(SubscriberCallbackDelegate<T> listener) where T : class` — Subscribes a callback to events of type `T` without filtering.
|
||||
|
||||
- `static void Subscribe<T>(SubscriberCallbackDelegate<T> listener, Predicate<T> eventFilter) where T : class` — Subscribes a callback to events of type `T` with an optional filter predicate. If the filter returns `false` for a given event, the callback is not invoked.
|
||||
|
||||
- `static void UnSubscribe<T>(SubscriberCallbackDelegate<T> listener) where T : class` — Removes a subscriber callback from the subscriber
|
||||
43
docs/ai/Common/DTS.Common.Core/PluginLib.md
Normal file
43
docs/ai/Common/DTS.Common.Core/PluginLib.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Core/PluginLib/PluginConfigData.cs
|
||||
- Common/DTS.Common.Core/PluginLib/PluginConfig.cs
|
||||
- Common/DTS.Common.Core/PluginLib/PluginConfigSectionHandler.cs
|
||||
- Common/DTS.Common.Core/PluginLib/PluginManager.cs
|
||||
generated_at: "2026-04-17T15:36:54.153860+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "9804f9dd2a12c0c7"
|
||||
---
|
||||
|
||||
# PluginLib Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
The `PluginLib` module provides a Managed Extensibility Framework (MEF)-based plugin system for the DTS application. It handles discovery, loading, and retrieval of plugins from configurable directories, supporting both single-plugin resolution and multiple implementations of the same contract. The module implements a thread-safe singleton pattern to manage the plugin catalog and container lifecycle.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### PluginManager (Class)
|
||||
The primary entry point for plugin operations.
|
||||
|
||||
**Properties:**
|
||||
- `AggregateCatalog PluginCatalog { get; set; }` — The MEF aggregate catalog containing all loaded plugin catalogs.
|
||||
|
||||
**Methods:**
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `public static T GetPlugin<T>() where T : class` | Retrieves a single MEF export of type `T`. Returns `null` if no export exists. |
|
||||
| `public static T GetPlugin<T>(string configPluginSetting) where T : class` | Retrieves a specific plugin from multiple exports by matching `configPluginSetting` against the plugin's `ToString()` value. |
|
||||
| `public static IEnumerable<Lazy<T>> GetPlugins<T>() where T : class` | Returns all MEF exports of type `T` as lazy-initialized references. |
|
||||
| `public static PluginManager GetPluginManager(string appPath)` | Returns the singleton instance of `PluginManager`. Initializes the manager on first call with the provided `appPath`. |
|
||||
| `public List<Assembly> GetPluginList<T>() where T : class` | Returns a list of distinct assemblies from all loaded directory catalogs. |
|
||||
|
||||
### PluginConfig (Static Class)
|
||||
Stores plugin configuration constants and helpers.
|
||||
|
||||
**Constants:**
|
||||
- `public const string DTSPlugins = "DTSPlugins"`
|
||||
13
docs/ai/Common/DTS.Common.Core/Properties.md
Normal file
13
docs/ai/Common/DTS.Common.Core/Properties.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Core/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:26:29.253325+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "237c2df86524839a"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly metadata for the
|
||||
61
docs/ai/Common/DTS.Common.Core/ServiceManager.md
Normal file
61
docs/ai/Common/DTS.Common.Core/ServiceManager.md
Normal file
@@ -0,0 +1,61 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Core/ServiceManager/IServicePublishedEvent.cs
|
||||
- Common/DTS.Common.Core/ServiceManager/ServicePublishedEvent.cs
|
||||
- Common/DTS.Common.Core/ServiceManager/ServiceManager.cs
|
||||
generated_at: "2026-04-17T16:35:08.366069+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "97facc88d83d9155"
|
||||
---
|
||||
|
||||
# ServiceManager Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
The ServiceManager module provides a service locator pattern implementation that enables loose coupling between components. It allows a component to publish an implementation of a singleton interface (service) that other components can retrieve without knowing the publisher. The module includes an event system (`IServicePublishedEvent`/`ServicePublishedEvent`) that notifies subscribers when services are published or unpublished, enabling reactive dependency management across the application.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `IServicePublishedEvent` (interface)
|
||||
**File:** `IServicePublishedEvent.cs`
|
||||
|
||||
Event contract fired when a service interface is published or unpublished.
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `ServiceType` | `Type` | Returns the type of service being published/unpublished. |
|
||||
| `IsPublished` | `bool` | Returns `true` if the service is being published, `false` if being unpublished. |
|
||||
|
||||
---
|
||||
|
||||
### `ServicePublishedEvent` (class)
|
||||
**File:** `ServicePublishedEvent.cs`
|
||||
|
||||
Concrete implementation of `IServicePublishedEvent`.
|
||||
|
||||
| Property | Type | Accessor | Description |
|
||||
|----------|------|----------|-------------|
|
||||
| `ServiceType` | `Type` | `get; internal set;` | The type of service being published/unpublished. |
|
||||
| `IsPublished` | `bool` | `get; internal set;` | `true` if publishing, `false` if unpublishing. |
|
||||
|
||||
---
|
||||
|
||||
### `ServiceManager` (static class)
|
||||
**File:** `ServiceManager.cs`
|
||||
|
||||
Static service locator that manages publication and retrieval of singleton services.
|
||||
|
||||
#### Methods
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `void Publish<T>(T item) where T : class` | Publishes a service implementation for interface type `T`. Throws `ArgumentException` if `T` is already published. |
|
||||
| `void Publish(object item, IEnumerable<Type> interfaceList, bool skipPublishedInterfaces)` | Publishes a single object as the implementation for multiple interfaces. If `skipPublishedInterfaces` is `false`, throws `ArgumentException` for any already-published interface; if `true`, silently skips already-published interfaces. |
|
||||
| `bool Exists<T>() where T : class` | Returns `true` if interface type `T` has been published; otherwise `false`. |
|
||||
| `bool Exists(Type t)` | Returns `true` if the specified interface type has been published; otherwise `false`. |
|
||||
| `T Get<T>() where T : class` | Returns the published service for interface type `T`. Throws `ArgumentException` if `T` has not been published. |
|
||||
| `void Clear<T>() where T : class` | Unpublishes the service for interface type `T` if it exists. Fires an unpublish event. |
|
||||
| `void Clear(IEnumerable
|
||||
39
docs/ai/Common/DTS.Common.Core/Settings.md
Normal file
39
docs/ai/Common/DTS.Common.Core/Settings.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Core/Settings/SettingsChangedEventArgs.cs
|
||||
- Common/DTS.Common.Core/Settings/SettingsCollection.cs
|
||||
generated_at: "2026-04-17T15:40:38.741606+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "a2f3cb745d88ce73"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.Core.Settings
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides an observable dictionary implementation for managing application settings. The `SettingsCollection<TKey, TItem>` class wraps a standard `Dictionary<TKey, TItem>` and raises events when items are added, removed, modified, or when the collection is cleared. This enables consumers to react to configuration changes in real-time. The module exists to provide change-notification semantics for settings management, allowing dependent components to synchronize state when settings are mutated.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `SettingsCollection<TKey, TItem>`
|
||||
|
||||
A generic dictionary implementation that implements `IDictionary<TKey, TItem>` with change notification support.
|
||||
|
||||
#### Event
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `event EventHandler<SettingsChangedEventArgs<TKey, TItem>> CollectionItemPropertyChanged` | Fired after any mutation operation (add, remove, modify, clear) on the collection. |
|
||||
|
||||
#### Methods
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `void Add(TKey key, TItem value)` | Adds a key-value pair to the collection and fires `CollectionItemPropertyChanged` with `ChangeSettingType.Add`. |
|
||||
| `void Add(KeyValuePair<TKey, TItem> item)` | Adds a key-value pair via `KeyValuePair` and fires `CollectionItemPropertyChanged` with `ChangeSettingType.Add`. |
|
||||
| `bool Remove(TKey key)` | Removes the item with the specified key. Returns `true` if removed; fires `CollectionItemPropertyChanged` with `ChangeSettingType.Remove` only on successful removal. |
|
||||
| `bool Remove(KeyValuePair<TKey, TItem> item)` | Removes by key (value is ignored). Returns `true` if removed; fires `CollectionItemPropertyChanged` with `ChangeSettingType.Remove` only on successful removal. |
|
||||
| `void Clear()` | Clears all items and fires `CollectionItemPropertyChanged` with `ChangeSetting
|
||||
Reference in New Issue
Block a user