6.0 KiB
6.0 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T04:38:16.817195+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 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→ExtraPropertiesListViewModelIExtraPropertiesListView→ExtraPropertiesListView
This method is called both directly during module initialization and viaRegisterTypes.
void OnInitialized(IContainerProvider containerProvider)
Currently empty; no logic implemented.void RegisterTypes(IContainerRegistry containerRegistry)
Delegates toInitialize()(despite receiving aIContainerRegistry, it uses the injectedIUnityContainerinstead).
ExtraPropertiesModuleNameAttribute class
ExtraPropertiesModuleNameAttribute()/ExtraPropertiesModuleNameAttribute(string s)
Constructor; ignores thestring sparameter. SetsAssemblyNametoAssemblyNames.ExtraProperties.ToString().string AssemblyName { get; }
Returns"ExtraProperties"(value ofAssemblyNames.ExtraProperties.ToString()).Type GetAttributeType()
Returnstypeof(TextAttribute).string GetAssemblyName()
ReturnsAssemblyName.
ExtraPropertiesModuleImageAttribute class
ExtraPropertiesModuleImageAttribute()/ExtraPropertiesModuleImageAttribute(string s)
Constructor; initializes_imgby callingAssemblyInfo.GetImage("ExtraProperties").BitmapImage AssemblyImage { get; }
Returns the image retrieved viaAssemblyInfo.GetImage("ExtraProperties").string AssemblyName { get; }
Returns"ExtraProperties".string AssemblyGroup { get; }
Returns"Prepare"(value ofeAssemblyGroups.Prepare.ToString()).eAssemblyRegion AssemblyRegion { get; }
ReturnseAssemblyRegion.ExtraPropertiesRegion.Type GetAttributeType()
Returnstypeof(ImageAttribute).BitmapImage GetAssemblyImage()/string GetAssemblyName()/string GetAssemblyGroup()/eAssemblyRegion GetAssemblyRegion()
Public overrides returning the corresponding property values.
3. Invariants
AssemblyNamefor both attributes is strictly"ExtraProperties"(derived fromAssemblyNames.ExtraProperties).AssemblyGroupis strictly"Prepare"(derived fromeAssemblyGroups.Prepare).AssemblyRegionis strictlyeAssemblyRegion.ExtraPropertiesRegion.- The
ExtraPropertiesListViewandExtraPropertiesListViewModeltypes 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(viaIUnityContainer,Unitynamespace)Prism.Modularity(viaIModule,ModuleAttribute)Prism.Ioc(viaIContainerRegistry,IContainerProvider)DTS.Common.Interface.ISO.ExtraProperties(viaIExtraPropertiesListView,IExtraPropertiesListViewModel)DTS.Common(viaAssemblyNames,eAssemblyGroups,eAssemblyRegion,AssemblyInfo)System.Windows.Media.Imaging(viaBitmapImage)System.ComponentModel.Composition(viaExportAttribute)
Used by:
- The Prism bootstrapper/container infrastructure (to discover and load
ExtraPropertiesModuleas anIModule). - The UI composition layer (to retrieve module metadata—name, image, group, region—via reflection on the assembly attributes).
5. Gotchas
RegisterTypesignores its parameter: Despite receivingIContainerRegistry,RegisterTypescallsInitialize(), which uses the injectedIUnityContainerinstead. 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
ExtraPropertiesModuleNameAttributeandExtraPropertiesModuleImageAttributeare applied at the assembly level (via[assembly: ...]), but their constructors accept an unusedstringparameter—likely legacy or placeholder. - No error handling in image loading:
AssemblyInfo.GetImage(...)is called in the constructor and property getter ofExtraPropertiesModuleImageAttribute. If the image resource is missing or malformed, this could cause runtime exceptions during assembly loading or attribute enumeration. OnInitializedis empty: Suggests incomplete implementation or deferred logic.- No validation of view/view-model types: Assumes
ExtraPropertiesListViewandExtraPropertiesListViewModelexist and implement their respective interfaces. A mismatch would only surface at runtime during resolution. - No documentation for
AssemblyNames,eAssemblyGroups,eAssemblyRegion, orAssemblyInfo: These types are referenced but not defined in this file; their values and constraints are inferred solely from usage.