init
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/ISO/ExtraProperties/ExtraPropertiesModule.cs
|
||||
generated_at: "2026-04-16T04:38:16.817195+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "02a142220d3db719"
|
||||
---
|
||||
|
||||
# ExtraProperties
|
||||
|
||||
## Documentation: ExtraPropertiesModule
|
||||
|
||||
### 1. Purpose
|
||||
The `ExtraPropertiesModule` is a Prism module responsible for registering the view and view model components for the *Extra Properties* feature within the application’s UI. It integrates with the Unity dependency injection container to expose `IExtraPropertiesListView` and `IExtraPropertiesListViewModel` as singleton services, enabling modular, testable, and decoupled UI construction. Additionally, it contributes assembly-level metadata (name, image, group, region) via custom attributes (`ExtraPropertiesModuleNameAttribute`, `ExtraPropertiesModuleImageAttribute`) to support dynamic UI composition—specifically, for display on the main screen’s summary of available modules.
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `ExtraPropertiesModule` class
|
||||
- **`ExtraPropertiesModule(IUnityContainer unityContainer)`**
|
||||
Constructor. Accepts a Unity container via dependency injection and stores it for later use in type registration.
|
||||
- **`void Initialize()`**
|
||||
Registers two types as singletons in the Unity container:
|
||||
- `IExtraPropertiesListViewModel` → `ExtraPropertiesListViewModel`
|
||||
- `IExtraPropertiesListView` → `ExtraPropertiesListView`
|
||||
This method is called both directly during module initialization and via `RegisterTypes`.
|
||||
- **`void OnInitialized(IContainerProvider containerProvider)`**
|
||||
Currently empty; no logic implemented.
|
||||
- **`void RegisterTypes(IContainerRegistry containerRegistry)`**
|
||||
Delegates to `Initialize()` (despite receiving a `IContainerRegistry`, it uses the injected `IUnityContainer` instead).
|
||||
|
||||
#### `ExtraPropertiesModuleNameAttribute` class
|
||||
- **`ExtraPropertiesModuleNameAttribute()` / `ExtraPropertiesModuleNameAttribute(string s)`**
|
||||
Constructor; ignores the `string s` parameter. Sets `AssemblyName` to `AssemblyNames.ExtraProperties.ToString()`.
|
||||
- **`string AssemblyName { get; }`**
|
||||
Returns `"ExtraProperties"` (value of `AssemblyNames.ExtraProperties.ToString()`).
|
||||
- **`Type GetAttributeType()`**
|
||||
Returns `typeof(TextAttribute)`.
|
||||
- **`string GetAssemblyName()`**
|
||||
Returns `AssemblyName`.
|
||||
|
||||
#### `ExtraPropertiesModuleImageAttribute` class
|
||||
- **`ExtraPropertiesModuleImageAttribute()` / `ExtraPropertiesModuleImageAttribute(string s)`**
|
||||
Constructor; initializes `_img` by calling `AssemblyInfo.GetImage("ExtraProperties")`.
|
||||
- **`BitmapImage AssemblyImage { get; }`**
|
||||
Returns the image retrieved via `AssemblyInfo.GetImage("ExtraProperties")`.
|
||||
- **`string AssemblyName { get; }`**
|
||||
Returns `"ExtraProperties"`.
|
||||
- **`string AssemblyGroup { get; }`**
|
||||
Returns `"Prepare"` (value of `eAssemblyGroups.Prepare.ToString()`).
|
||||
- **`eAssemblyRegion AssemblyRegion { get; }`**
|
||||
Returns `eAssemblyRegion.ExtraPropertiesRegion`.
|
||||
- **`Type GetAttributeType()`**
|
||||
Returns `typeof(ImageAttribute)`.
|
||||
- **`BitmapImage GetAssemblyImage()` / `string GetAssemblyName()` / `string GetAssemblyGroup()` / `eAssemblyRegion GetAssemblyRegion()`**
|
||||
Public overrides returning the corresponding property values.
|
||||
|
||||
### 3. Invariants
|
||||
- `AssemblyName` for both attributes is strictly `"ExtraProperties"` (derived from `AssemblyNames.ExtraProperties`).
|
||||
- `AssemblyGroup` is strictly `"Prepare"` (derived from `eAssemblyGroups.Prepare`).
|
||||
- `AssemblyRegion` is strictly `eAssemblyRegion.ExtraPropertiesRegion`.
|
||||
- The `ExtraPropertiesListView` and `ExtraPropertiesListViewModel` types are registered as *singleton* instances in the Unity container during module initialization.
|
||||
- Both attributes are assembly-level (`AttributeTargets.Assembly`), non-repeatable (`AllowMultiple = false`), and must be applied exactly once per assembly.
|
||||
|
||||
### 4. Dependencies
|
||||
**Depends on:**
|
||||
- `Unity` (via `IUnityContainer`, `Unity` namespace)
|
||||
- `Prism.Modularity` (via `IModule`, `ModuleAttribute`)
|
||||
- `Prism.Ioc` (via `IContainerRegistry`, `IContainerProvider`)
|
||||
- `DTS.Common.Interface.ISO.ExtraProperties` (via `IExtraPropertiesListView`, `IExtraPropertiesListViewModel`)
|
||||
- `DTS.Common` (via `AssemblyNames`, `eAssemblyGroups`, `eAssemblyRegion`, `AssemblyInfo`)
|
||||
- `System.Windows.Media.Imaging` (via `BitmapImage`)
|
||||
- `System.ComponentModel.Composition` (via `ExportAttribute`)
|
||||
|
||||
**Used by:**
|
||||
- The Prism bootstrapper/container infrastructure (to discover and load `ExtraPropertiesModule` as an `IModule`).
|
||||
- The UI composition layer (to retrieve module metadata—name, image, group, region—via reflection on the assembly attributes).
|
||||
|
||||
### 5. Gotchas
|
||||
- **`RegisterTypes` ignores its parameter**: Despite receiving `IContainerRegistry`, `RegisterTypes` calls `Initialize()`, which uses the *injected* `IUnityContainer` instead. This tightly couples the module to Unity and breaks Prism’s abstraction (e.g., it would fail if used with a different DI container).
|
||||
- **Redundant attribute usage**: Both `ExtraPropertiesModuleNameAttribute` and `ExtraPropertiesModuleImageAttribute` are applied at the assembly level (via `[assembly: ...]`), but their constructors accept an unused `string` parameter—likely legacy or placeholder.
|
||||
- **No error handling in image loading**: `AssemblyInfo.GetImage(...)` is called in the constructor and property getter of `ExtraPropertiesModuleImageAttribute`. If the image resource is missing or malformed, this could cause runtime exceptions during assembly loading or attribute enumeration.
|
||||
- **`OnInitialized` is empty**: Suggests incomplete implementation or deferred logic.
|
||||
- **No validation of view/view-model types**: Assumes `ExtraPropertiesListView` and `ExtraPropertiesListViewModel` exist and implement their respective interfaces. A mismatch would only surface at runtime during resolution.
|
||||
- **No documentation for `AssemblyNames`, `eAssemblyGroups`, `eAssemblyRegion`, or `AssemblyInfo`**: These types are referenced but not defined in this file; their values and constraints are inferred solely from usage.
|
||||
Reference in New Issue
Block a user