This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,103 @@
---
source_files:
- Common/DTS.CommonCore/Base/Classes/BasePropertyChanged.cs
- Common/DTS.CommonCore/Base/Classes/DisplayResourceAttribute.cs
- Common/DTS.CommonCore/Base/Classes/DescriptionResourceAttribute.cs
- Common/DTS.CommonCore/Base/Classes/DynamicTypeDescriptor.cs
generated_at: "2026-04-17T15:37:43.148987+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "3c060c718b0c2281"
---
# Documentation: DTS.Common.Base Classes
## 1. Purpose
This module provides foundational infrastructure for the DTS common core library, offering three distinct capabilities: (1) a base implementation of the `INotifyPropertyChanged` pattern via `BasePropertyChanged` for MVVM-style data binding; (2) localization-aware attributes (`DisplayResourceAttribute` and `DescriptionResourceAttribute`) that resolve display names and descriptions from a centralized string resource manager at runtime; and (3) a sophisticated `DynamicTypeDescriptor` class that enables runtime modification of type metadata for scenarios requiring dynamic property grids or flexible property systems, such as Entity Framework scenarios where design-time properties need runtime adjustment.
---
## 2. Public Interface
### BasePropertyChanged (Abstract Class)
**Implements:** `IBasePropertyChanged`
| Member | Signature | Description |
|--------|-----------|-------------|
| `PropertyChanged` | `event PropertyChangedEventHandler PropertyChanged` | Event raised when a property value changes. Marked `virtual`. |
| `SetProperty<T>` | `bool SetProperty<T>(ref T storage, T value, String propertyName = null)` | Sets the property value if different from current; returns `true` if changed, `false` otherwise. Raises `PropertyChanged` on change. |
| `OnPropertyChanged` | `void OnPropertyChanged(string propertyName = null)` | Raises the `PropertyChanged` event. Marked `virtual`. |
---
### DisplayResourceAttribute (Class)
**Inherits:** `DisplayNameAttribute`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `DisplayResourceAttribute(string resourceId)` | Initializes with a resource identifier to look up. |
| `DisplayName` | `override string DisplayName` | Looks up the display name via `Strings.Strings.ResourceManager.GetString(_resourceId)`. Returns `"##ResourceNotFound##" + _resourceId` if lookup fails. |
---
### DescriptionResourceAttribute (Class)
**Inherits:** `DescriptionAttribute`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `DescriptionResourceAttribute(string resourceId)` | Initializes with a resource identifier to look up. |
| `Description` | `override string Description` | Looks up the description via `Strings.Strings.ResourceManager.GetString(_resourceId)`. Returns `"##DescriptionNotFound##" + _resourceId` if lookup fails. |
---
### DynamicTypeDescriptor (Sealed Class)
**Implements:** `ICustomTypeDescriptor`, `INotifyPropertyChanged`
| Member | Signature | Description |
|--------|-----------|-------------|
| `PropertyChanged` | `event PropertyChangedEventHandler PropertyChanged` | Event raised when a property value changes. |
| Constructor | `DynamicTypeDescriptor(Type type)` | Initializes from a `Type`. Throws `ArgumentNullException` if `type` is null. Filters to only browsable properties. |
| `GetPropertyValue<T>` | `T GetPropertyValue<T>(string name, T defaultValue)` | Gets a property value by name, returning `defaultValue` if not found or on conversion failure. Throws `ArgumentNullException` if `name` is null. |
| `SetPropertyValue` | `void SetPropertyValue(string name, object value)` | Sets a property value by name. Throws `ArgumentNullException` if `name` is null. |
| `AddProperty` (overload 1) | `PropertyDescriptor AddProperty(Type type, string name, object value, string displayName, string description, string category, bool hasDefaultValue, object defaultValue, bool readOnly)` | Adds a dynamically defined property. |
| `AddProperty` (overload 2) | `PropertyDescriptor AddProperty(Type type, string name, object value, string displayName, string description, string category, bool hasDefaultValue, object defaultValue, bool readOnly, Type uiTypeEditor)` | Adds a dynamically defined property with a UI type editor. Throws `ArgumentNullException` if `type` or `name` is null. |
| `AddProperty` (overload 3) | `void AddProperty(PropertyDescriptor property)` | Adds an existing `PropertyDescriptor`. Throws `ArgumentNullException` if `property` is null. |
| `RemoveProperty` | `void RemoveProperty(string name)` | Removes all properties matching the given name. Throws `ArgumentNullException` if `name` is null. |
| `FromComponent` | `DynamicTypeDescriptor FromComponent(object component)` | Creates a new `DynamicTypeDescriptor` bound to a specific component instance. Throws `ArgumentNullException` if `component` is null; throws `ArgumentException` if component type is not assignable to `_type`. |
| `OriginalProperties` | `PropertyDescriptorCollection OriginalProperties { get; }` | The original properties from `TypeDescriptor.GetProperties(type)`. |
| `Properties` | `PropertyDescriptorCollection Properties { get; }` | The current (potentially modified) property collection. |
| `Component` | `object Component { get; }` | The bound component instance. |
| `ClassName` | `string ClassName { get; set; }` | Optional override for class name. |
| `ComponentName` | `string ComponentName { get; set; }` | Optional override for component name. |
#### DynamicTypeDescriptor.DynamicProperty (Nested Sealed Class)
**Inherits:** `PropertyDescriptor`, **Implements:** `INotifyPropertyChanged`
| Member | Signature | Description |
|--------|-----------|-------------|
| `PropertyChanged` | `event PropertyChangedEventHandler PropertyChanged` | Event raised when the property value changes. |
| `Value` | `object Value { get; set; }` | The current value (used when no existing property descriptor). |
| `AttributesList` | `IList<Attribute> AttributesList { get; }` | Mutable list of attributes. |
| `Attributes` | `override AttributeCollection Attributes { get; }` | Returns attributes as a collection. |
| `SetBrowsable` | `void SetBrowsable(bool browsable)` | Overrides the `IsBrowsable` behavior. |
| `SetIsReadOnly` | `void SetIsReadOnly(bool readOnly)` | Overrides the `IsReadOnly` behavior. |
| `SetDisplayName` | `void SetDisplayName(string displayName)` | Overrides the `DisplayName`. |
| `SetDescription` | `void SetDescription(string description)` | Overrides the `Description`. |
| `SetCategory` | `void SetCategory(string category)` | Overrides the `Category`. |
| `SetEditor` | `void SetEditor(Type editorBaseType, object obj)` | Sets or removes an editor for a given editor base type. |
| `RemoveAttributesOfType<T>` | `void RemoveAttributesOfType<T>() where T : Attribute` | Removes all attributes of the specified type from the property. |
| Standard `PropertyDescriptor` overrides | `CanResetValue`, `GetValue`, `SetValue`, `ResetValue`, `ShouldSerializeValue`, `GetEditor`, etc. | Standard property descriptor behavior, delegating to existing property when available. |
---
## 3. Invariants
### BasePropertyChanged
- `SetProperty<T>` will **not** raise `PropertyChanged` if `storage` equals `value` (returns `false` early).
- `SetProperty<T>` will **always** raise `

View File

@@ -0,0 +1,88 @@
---
source_files:
- Common/DTS.CommonCore/Base/Interface/IBaseClass.cs
- Common/DTS.CommonCore/Base/Interface/IViewModel.cs
- Common/DTS.CommonCore/Base/Interface/IBaseView.cs
- Common/DTS.CommonCore/Base/Interface/IBaseWindow.cs
- Common/DTS.CommonCore/Base/Interface/IBaseModel.cs
- Common/DTS.CommonCore/Base/Interface/IBasePropertyChanged.cs
- Common/DTS.CommonCore/Base/Interface/IHeaderInfoProvider.cs
- Common/DTS.CommonCore/Base/Interface/IBaseWindowModel.cs
- Common/DTS.CommonCore/Base/Interface/IBaseViewModel.cs
generated_at: "2026-04-17T16:04:27.057929+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "c772b146b8c7aa51"
---
# Interface
### Purpose
This module defines the fundamental contracts for the MVVM (Model-View-ViewModel) architecture used within the `DTS.CommonCore` library. It establishes the base interfaces for property change notification, data models, views, and view models, ensuring a consistent approach to data binding and lifecycle management across the system.
### Public Interface
* **`interface IBasePropertyChanged : INotifyPropertyChanged`**
* Extends `INotifyPropertyChanged` to add a manual notification method.
* `void OnPropertyChanged(string propertyName)`: Raises the `PropertyChanged` event for the specified property name.
* **`interface IBaseClass : IBasePropertyChanged`**
* A marker interface for base classes that support property change notification. It defines no additional members.
* **`interface IBaseModel : IBasePropertyChanged`**
* Represents a data model with a persistent state tracking capability.
* `bool IsSaved { get; }`: Gets a value indicating whether the model is saved.
* **`interface IViewModel`**
* Defines a basic view model wrapper around a model object.
* `object Model { get; set; }`: Gets or sets the underlying data model object.
* **`interface IBaseView`**
* Defines a view element capable of data binding.
* `object DataContext { get; set; }`: Gets or sets the data context for the view.
* **`interface IBaseWindow`**
* Defines a window element capable of data binding.
* `object DataContext { get; set; }`: Gets or sets the data context for the window.
* **`interface IHeaderInfoProvider<T>`**
* Provides a mechanism for classes to expose header information for XAML binding.
* `T HeaderInfo { get; }`: Gets the header information.
* **`interface IBaseViewModel : IBasePropertyChanged`**
* Defines the lifecycle and state properties for a standard view model.
* `bool IsMenuIncluded { get; set; }`: Gets or sets whether a menu is included.
* `bool IsNavigationIncluded { get; set; }`: Gets or sets whether navigation is included.
* `bool IsBusy { get; set; }`: Gets or sets the busy state.
* `bool IsDirty { get; }`: Gets whether the view model has unsaved changes.
* `void Activated()`: Called when the view model is activated.
* `void Cleanup()`: Synchronously cleans up resources.
* `Task CleanupAsync()`: Asynchronously cleans up resources.
* `void Initialize()`: Initializes the view model.
* `void Initialize(object parameter)`: Initializes the view model with a parameter.
* `void Initialize(object parameter, object model)`: Initializes the view model with a parameter and a model.
* `Task InitializeAsync()`: Asynchronously initializes the view model.
* `Task InitializeAsync(object parameter)`: Asynchronously initializes the view model with a parameter.
* **`interface IBaseWindowModel : INotifyPropertyChanged`**
* Defines the lifecycle and state properties for a window-level model.
* `bool IsMenuIncluded { get; set; }`
* `bool IsNavigationIncluded { get; set; }`
* `bool IsBusy { get; set; }`
* `bool IsDirty { get; }`
* `void Activated()`
* `void Cleanup()`
* `Task CleanupAsync()`
* `void Initialize()`
* `void Initialize(object parameter)`
* `Task InitializeAsync()`
* `Task InitializeAsync(object parameter)`
### Invariants
* `IBaseView.DataContext` and `IBaseWindow.DataContext` must accept an object that is typically an implementation of `IBaseViewModel` or `IBaseWindowModel`.
* `IBaseViewModel.Initialize` overloads suggest that initialization logic must handle cases with zero, one, or two parameters.
* `IBaseWindowModel` inherits from `INotifyPropertyChanged` directly, whereas `IBaseViewModel` inherits from `IBasePropertyChanged`.
### Dependencies
* **Dependencies:** `System.ComponentModel`, `System.Threading.Tasks`.
* **Dep

View File

@@ -0,0 +1,76 @@
---
source_files:
- Common/DTS.CommonCore/Base/Model/BaseModel.cs
generated_at: "2026-04-17T16:40:06.536199+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "4cc2728963c0ba1e"
---
# Documentation: BaseModel.cs
## 1. Purpose
This module provides `BaseModel<TModel>`, an abstract generic base class designed to wrap domain model objects. It serves as a foundation for creating model wrapper classes that require property change notification capabilities and persistence state tracking. The class acts as a bridge between raw data models and UI/view-layer components in the DTS system.
## 2. Public Interface
### `BaseModel<TModel>` (Class)
**Signature:**
```csharp
public abstract class BaseModel<TModel> : BasePropertyChanged, IBaseModel
where TModel : class
```
**Description:** Abstract generic base class for model wrappers. Inherits from `BasePropertyChanged` and implements `IBaseModel`. The generic type parameter `TModel` is constrained to reference types only.
---
### `Model` (Property)
**Signature:**
```csharp
public TModel Model { get; set; }
```
**Description:** Gets or sets the wrapped model object. No validation or null-checking is performed in the setter.
---
### `BaseModel()` (Constructor)
**Signature:**
```csharp
public BaseModel()
```
**Description:** Public parameterless constructor. Creates a new instance with default property values.
---
### `IsSaved` (Property)
**Signature:**
```csharp
public bool IsSaved { get; private set; }
```
**Description:** Gets a boolean indicating whether the model has been saved. The setter is private.
## 3. Invariants
- **Generic Type Constraint:** `TModel` must be a reference type (`class` constraint).
- **Inheritance Chain:** All `BaseModel<TModel>` instances are also `BasePropertyChanged` instances and implement `IBaseModel`.
- **Constructor Accessibility:** Despite being abstract, the class exposes a public constructor.
## 4. Dependencies
### This module depends on:
- `BasePropertyChanged` — Base class providing property change notification (likely implements `INotifyPropertyChanged`).
- `IBaseModel` — Interface contract for model objects.
### Dependents:
- Cannot be determined from this source file alone. Any class that wraps a model object and needs property change notification would inherit from this base class.
## 5. Gotchas
- **Namespace Mismatch:** The file is located at `Common/DTS.CommonCore/Base/Model/BaseModel.cs` but the namespace is declared as `DTS.Common.Base`. The `// ReSharper disable CheckNamespace` directive suppresses the IDE warning for this mismatch.
- **Public Constructor in Abstract Class:** The class is abstract yet declares a public constructor. While legal

View File

@@ -0,0 +1,44 @@
---
source_files:
- Common/DTS.CommonCore/Base/View/BaseWindow.cs
- Common/DTS.CommonCore/Base/View/BaseView.cs
generated_at: "2026-04-17T16:07:35.691560+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "552d84b401685097"
---
# View
### Purpose
This module provides base classes for WPF view components within the DTS framework. It establishes a consistent pattern for views to expose dirty-state tracking and header information by delegating to their DataContext ViewModels. Both `BaseWindow` and `BaseView` serve as abstracted base types that bridge the gap between standard WPF controls (`Window`, `UserControl`) and the application's ViewModel contracts (`IBaseWindowModel`, `IBaseViewModel`, `IHeaderInfoProvider<string>`).
### Public Interface
**BaseWindow : Window, IBaseWindow**
- `bool IsDirty { get; }` — Returns `true` if the `DataContext` implements `IBaseWindowModel` and its `IsDirty` property is `true`. Returns `false` if `DataContext` is null or does not implement the interface.
- `string HeaderInfo { get; }` — Returns the `HeaderInfo` from `DataContext` if it implements `IHeaderInfoProvider<string>`. Returns `string.Empty` if `DataContext` is null or does not implement the interface.
**BaseView : UserControl, IBaseView**
- `bool IsDirty { get; }` — Returns `true` if the `DataContext` implements `IBaseViewModel` and its `IsDirty` property is `true`. Returns `false` if `DataContext` is null or does not implement the interface.
- `string HeaderInfo { get; }` — Returns the `HeaderInfo` from `DataContext` if it implements `IHeaderInfoProvider<string>`. Returns `string.Empty` if `DataContext` is null or does not implement the interface.
### Invariants
- `IsDirty` will never throw; it safely returns `false` when `DataContext` is null or incompatible.
- `HeaderInfo` will never throw; it safely returns `string.Empty` when `DataContext` is null or incompatible.
- Both properties are read-only getters with no setters.
### Dependencies
**Depends on:**
- `System.Windows` (Window class)
- `System.Windows.Controls` (UserControl class)
- `IBaseWindow`, `IBaseWindowModel`, `IBaseViewModel`, `IHeaderInfoProvider<string>` (interfaces not shown in source; assumed defined elsewhere in DTS.CommonCore or related assemblies)
**Depended on by:**
- Unclear from source alone; likely all Window and UserControl derivatives in the DTS application.
### Gotchas
- **Interface mismatch between BaseWindow and BaseView:** `BaseWindow.IsDirty` checks for `IBaseWindowModel`, while `BaseView.IsDirty` checks for `IBaseViewModel`. These are different interfaces. A ViewModel intended for use with both must implement both interfaces, or dirty state will report incorrectly in one context.
- The namespace is declared as `DTS.Common.Base` but the file path suggests `DTS.CommonCore`. This may indicate a historical namespace rename or intentional divergence.
---

View File

@@ -0,0 +1,45 @@
---
source_files:
- Common/DTS.CommonCore/Base/ViewModel/ViewModelBase.cs
- Common/DTS.CommonCore/Base/ViewModel/BaseViewModel.cs
generated_at: "2026-04-17T15:40:45.497045+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "72dbfa917d46895e"
---
# Documentation: DTS.Common.Base ViewModel Classes
## 1. Purpose
This module provides two abstract base classes for the Model-View-ViewModel (MVVM) pattern within the DTS application framework. `ViewModelBase<T>` offers a foundational implementation for ViewModels that need property change notification, error handling, and asynchronous model initialization while inheriting from WPF's `DependencyObject`. `BaseViewModel<TModel>` provides a more feature-rich base class with Prism framework integration, including command management, region navigation, event aggregation, and dependency injection support. Both classes establish a consistent contract for ViewModel lifecycle management across the codebase.
---
## 2. Public Interface
### ViewModelBase\<T\>
**Type:** `abstract class`
**Inheritance:** `DependencyObject`, `INotifyPropertyChanged`, `IViewModel`
#### Properties
| Name | Type | Access | Description |
|------|------|--------|-------------|
| `Model` | `object` | get/set | The Model object instance. Note: typed as `object` despite generic parameter `T`. |
| `IsBusy` | `bool` | get/protected set | Indicates whether an asynchronous process is currently executing. |
| `IsDirty` | `bool` | get/protected set | Indicates whether the Model has been changed. Virtual. |
#### Events
| Name | Type | Description |
|------|------|-------------|
| `ErrorOccurred` | `EventHandler<ErrorEventArgs>` | Raised when an error occurs during processing. Virtual. |
| `PropertyChanged` | `PropertyChangedEventHandler` | Raised when a property value changes. Virtual. |
#### Abstract Methods (must be implemented by derived classes)
| Signature | Description |
|-----------|-------------|
| `protected abstract Task<T> InitializeAsync()` | Async initialization that returns the model object. Result is intended to set