7.3 KiB
7.3 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T04:49:30.522340+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 9857e307f8488ab7 |
CachedItemsList
Documentation: CachedItemsListModule
Purpose
The CachedItemsListModule is a Prism-based modular component responsible for registering the view and view model for the Cached Items List UI feature within the application’s dependency injection container (Unity). It enables dynamic loading and integration of the CachedItemsList feature as a Prism module, exposing its UI components (CachedItemsListView and CachedItemsListViewModel) as singleton services via interface abstractions (ICachedItemsListView, ICachedItemsListViewModel). The module also contributes metadata (name, image, group, region) to the host application’s module discovery and UI assembly system via custom assembly-level attributes.
Public Interface
Class: CachedItemsListModule
- Namespace:
CachedItemsList - Inherits:
IModule(Prism.Modularity) - Attributes:
[Export(typeof(IModule))],[Module(ModuleName = "CachedItemsListModule")]
| Member | Signature | Description |
|---|---|---|
| Constructor | public CachedItemsListModule(IUnityContainer unityContainer) |
Initializes the module with the Unity container instance via DI. Stores reference for later registration. |
Initialize() |
public void Initialize() |
Registers the view and view model types as singletons in the Unity container: • ICachedItemsListView → CachedItemsListView • ICachedItemsListViewModel → CachedItemsListViewModel |
OnInitialized(IContainerProvider containerProvider) |
public void OnInitialized(IContainerProvider containerProvider) |
Currently empty. No initialization logic beyond registration. |
RegisterTypes(IContainerRegistry containerRegistry) |
public void RegisterTypes(IContainerRegistry containerRegistry) |
Delegates to Initialize(). (Note: Uses IContainerRegistry from Prism, but internally calls IUnityContainer-based Initialize(); may indicate legacy or transitional DI usage.) |
Attribute: CachedItemsListModuleNameAttribute
- Namespace:
CachedItemsList - Inherits:
TextAttribute(fromDTS.Common.Interface) - Usage:
[assembly: CachedItemsListModuleName]
| Member | Signature | Description |
|---|---|---|
| Constructor | public CachedItemsListModuleNameAttribute(string s = null) |
Initializes with optional parameter (unused). |
AssemblyName |
public override string AssemblyName { get; } |
Returns "CachedItemsList" (from AssemblyNames.CachedItemsList.ToString()). |
GetAttributeType() |
public override Type GetAttributeType() |
Returns typeof(TextAttribute). |
GetAssemblyName() |
public override string GetAssemblyName() |
Returns AssemblyName. |
Attribute: CachedItemsListModuleImageAttribute
- Namespace:
CachedItemsList - Inherits:
ImageAttribute(fromDTS.Common.Interface) - Usage:
[assembly: CachedItemsListModuleImageAttribute]
| Member | Signature | Description |
|---|---|---|
| Constructor | public CachedItemsListModuleImageAttribute(string s = null) |
Initializes image and name by calling AssemblyInfo.GetImage(...). |
AssemblyImage |
public override BitmapImage AssemblyImage { get; } |
Returns a BitmapImage loaded via AssemblyInfo.GetImage("CachedItemsList"). |
AssemblyName |
public override string AssemblyName { get; } |
Returns "CachedItemsList". |
AssemblyGroup |
public override string AssemblyGroup { get; } |
Returns "Prepare" (from eAssemblyGroups.Prepare.ToString()). |
AssemblyRegion |
public override eAssemblyRegion AssemblyRegion { get; } |
Returns eAssemblyRegion.CachedItemsListRegion. |
GetAttributeType() |
public override Type GetAttributeType() |
Returns typeof(ImageAttribute). |
GetAssemblyImage() / GetAssemblyName() / GetAssemblyGroup() / GetAssemblyRegion() |
public override ... |
Delegates to corresponding properties. |
Invariants
- Singleton Registration: Both
ICachedItemsListViewandICachedItemsListViewModelare registered as singletons in the Unity container duringInitialize(). This implies only one instance of each will exist per application lifetime. - Module Name Consistency: The module’s registered name (
"CachedItemsListModule") and assembly metadata (AssemblyNames.CachedItemsList.ToString()) must match expected values by the host application for correct module loading and UI integration. - Region Mapping: The
AssemblyRegionis fixed toeAssemblyRegion.CachedItemsListRegion, indicating the module expects to be injected into a region of that name (e.g., via Prism’sRegionManager). - Group Membership: The module belongs to the
"Prepare"group (eAssemblyGroups.Prepare), likely used for UI categorization (e.g., in a module selection screen).
Dependencies
Dependencies of this module
- Prism.Modularity: Requires
IModuleinterface for Prism module lifecycle. - Unity Container: Uses
IUnityContainer(viaUnitynamespace) for type registration. - DTS.Common & DTS.Common.Interface: Relies on:
AssemblyNames.CachedItemsListenum value.AssemblyInfo.GetImage(...)method for image loading.eAssemblyGroups.Prepareenum value.eAssemblyRegion.CachedItemsListRegionenum value.- Base attribute types:
TextAttribute,ImageAttribute.
- WPF: Uses
System.Windows.Media.Imaging.BitmapImage(indicating this module targets WPF UI).
Dependencies on this module
- Host Application: The main application (not shown) must:
- Discover and load this module via Prism module catalog.
- Use
CachedItemsListRegionfor view injection. - Rely on
AssemblyInfo.GetImage(...)andAssemblyNamesfor UI rendering of module metadata.
Gotchas
- DI Container Mismatch:
RegisterTypesacceptsIContainerRegistry(Prism’s abstraction), but internally callsInitialize(), which usesIUnityContainer. This implies the module assumes Unity is the underlying container and may break if used with another DI container (e.g., DryIoc, Autofac) without adapter support. - Redundant
OnInitialized: TheOnInitializedmethod is empty and unused. If future logic is added here, ensure it does not conflict withInitialize()(which runs earlier). - Hardcoded Assembly Name:
"CachedItemsList"is hardcoded in multiple places (e.g.,AssemblyNames.CachedItemsList.ToString()). Renaming the assembly or enum value requires synchronized updates. - Image Loading Side Effects:
AssemblyInfo.GetImage(...)is called in the attribute constructor (during assembly load), which may cause runtime failures if the image resource is missing or path is incorrect—failures may occur before module initialization. - No View/ViewModel Initialization Logic: The module only registers types; no view initialization (e.g., setting
DataContext) occurs here. That responsibility likely resides in the host application or view-level Prism behaviors.
None identified beyond the above.