Files
DP44/enriched-partialglm/DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportResults.md

96 lines
6.1 KiB
Markdown
Raw Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportResults/PSDReportResultsModule.cs
generated_at: "2026-04-16T10:59:25.221294+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "1cb458d29a5aed08"
---
# Documentation: PSDReportResultsModule
## 1. Purpose
This module serves as the entry point for the "PSD Report Results" component within the DTS Viewer application. It is a Prism Module (`PSDReportResultsModule`) responsible for registering its associated View and ViewModel implementations with the Unity dependency injection container. Additionally, it defines assembly-level attributes to expose metadata (name, image, group, and region) to the broader application, likely for dynamic UI generation or navigation purposes.
## 2. Public Interface
### Class: `PSDReportResultsModule`
Implements `Prism.Modularity.IModule`.
* **`PSDReportResultsModule(IUnityContainer unityContainer)`**
* Constructor that accepts an `IUnityContainer` instance and stores it in a readonly field `_unityContainer`.
* **`void Initialize()`**
* Registers types with the Unity container.
* Maps `IPSDReportResultsViewModel` to `PSDReportResultsViewModel`.
* Maps `IPSDReportResultsView` to `PSDReportResultsView`.
* **`void OnInitialized(IContainerProvider containerProvider)`**
* Implementation of `IModule.OnInitialized`. Currently has an empty body (no logic executed).
* **`void RegisterTypes(IContainerRegistry containerRegistry)`**
* Implementation of `IModule.RegisterTypes`. Invokes the `Initialize()` method to perform dependency registration.
### Class: `PSDReportResultsModuleNameAttribute`
Inherits from `DTS.Common.Interface.TextAttribute`.
* **`PSDReportResultsModuleNameAttribute()`**
* Default constructor.
* **`PSDReportResultsModuleNameAttribute(string s)`**
* Constructor accepting a string argument `s` (which is unused in the body).
* **`override string AssemblyName { get; }`**
* Returns the string representation of `DTS.Common.AssemblyNames.PSDReportResults`.
* **`override Type GetAttributeType()`**
* Returns `typeof(TextAttribute)`.
* **`override string GetAssemblyName()`**
* Returns the `AssemblyName` property value.
### Class: `PSDReportResultsModuleImageAttribute`
Inherits from `DTS.Common.Interface.ImageAttribute`.
* **`PSDReportResultsModuleImageAttribute()`**
* Default constructor.
* **`PSDReportResultsModuleImageAttribute(string s)`**
* Constructor accepting a string argument `s`. Initializes the private `_img` field via `AssemblyInfo.GetImage`.
* **`override BitmapImage AssemblyImage { get; }`**
* Getter initializes (if null) and returns a `BitmapImage` retrieved via `AssemblyInfo.GetImage`.
* **`override string AssemblyName { get; }`**
* Returns the string representation of `DTS.Common.AssemblyNames.PSDReportResults`.
* **`override string AssemblyGroup { get; }`**
* Returns the string representation of `DTS.Common.eAssemblyGroups.Viewer`.
* **`override eAssemblyRegion AssemblyRegion { get; }`**
* Returns `DTS.Common.eAssemblyRegion.PSDReportResultsRegion`.
* **`override Type GetAttributeType()`**
* Returns `typeof(ImageAttribute)`.
* **`override BitmapImage GetAssemblyImage()`**
* Returns the `AssemblyImage` property.
* **`override string GetAssemblyName()`**
* Returns the `AssemblyName` property.
* **`override string GetAssemblyGroup()`**
* Returns the `AssemblyGroup` property.
* **`override eAssemblyRegion GetAssemblyRegion()`**
* Returns the `AssemblyRegion` property.
## 3. Invariants
* **Module Name:** The Prism module name is fixed as `"PSDReportResults"` via the `[Module]` attribute.
* **Assembly Group:** The module always identifies itself as part of the `Viewer` group via `eAssemblyGroups.Viewer`.
* **Assembly Region:** The module is always associated with `eAssemblyRegion.PSDReportResultsRegion`.
* **Type Registration:** The `IPSDReportResultsView` and `IPSDReportResultsViewModel` interfaces are strictly mapped to their concrete implementations `PSDReportResultsView` and `PSDReportResultsViewModel` respectively.
## 4. Dependencies
**Internal Dependencies (referenced types):**
* `DTS.Common`: Uses `AssemblyNames` enum.
* `DTS.Common.Interface`: Uses `TextAttribute`, `ImageAttribute`, `AssemblyInfo`, `eAssemblyGroups`, and `eAssemblyRegion`.
* `DTS.Viewer.PSDReportResults`: Contains the concrete `PSDReportResultsView` and `PSDReportResultsViewModel` (inferred from registration calls, though the namespace matches the file).
**External Frameworks:**
* `Prism.Ioc`: Uses `IContainerProvider`.
* `Prism.Modularity`: Uses `IModule`, `ModuleAttribute`.
* `Unity`: Uses `IUnityContainer`.
* `System.Windows.Media.Imaging`: Uses `BitmapImage`.
## 5. Gotchas
* **Redundant Initialization Logic:** The `RegisterTypes` method calls `Initialize()`. This is unusual; typically, `RegisterTypes` uses the passed `IContainerRegistry` argument for registration, while `Initialize` uses the injected `IUnityContainer`. Here, the module ignores the `IContainerRegistry` argument and relies on the injected `_unityContainer` inside `Initialize`. This mixes Prism's modular initialization lifecycle with direct Unity container usage.
* **Unused Constructor Parameters:** Both attribute classes (`PSDReportResultsModuleNameAttribute` and `PSDReportResultsModuleImageAttribute`) have constructors accepting a `string s` parameter. In both cases, this parameter is completely ignored in the implementation.
* **Property Side Effects:** The getter for `PSDReportResultsModuleImageAttribute.AssemblyImage` has a side effect: it assigns a value to the private `_img` field if accessed. While the constructor also attempts to set this, the property getter logic `_img = ...; return _img;` will re-fetch the image every time if `_img` is null, or overwrite it if called repeatedly (though the logic implies it just returns it after assignment).
* **Empty Lifecycle Hook:** `OnInitialized` is explicitly empty. If initialization logic were required to run after container registration, it would need to be added here, but currently, it does nothing.