6.4 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T13:44:59.673795+00:00 | zai-org/GLM-5-FP8 | 1 | bcd5ac559d7f6d8e |
Documentation: ChartOptionsModule.cs
1. Purpose
This module serves as the Prism module initializer for the DTS.Viewer.ChartOptions component within the DTS Viewer application. It is responsible for registering chart options-related views, view models, and models with the Unity dependency injection container, and provides assembly-level metadata (name, image, group, region) that the main application uses to discover and display this module as an available component.
2. Public Interface
ChartOptionsModule Class
Implements Prism.Modularity.IModule. The primary module entry point.
| Member | Signature | Description |
|---|---|---|
| Constructor | ChartOptionsModule(IUnityContainer unityContainer) |
Accepts an injected Unity container reference. |
RegisterTypes |
void RegisterTypes(IContainerRegistry containerRegistry) |
Registers types with the container. Calls Initialize(). |
OnInitialized |
void OnInitialized(IContainerProvider containerProvider) |
Empty implementation (no post-initialization logic). |
Initialize |
void Initialize() |
Registers IChartOptionsView → ChartOptionsView, IChartOptionsViewModel → ChartOptionsViewModel, and IChartOptionsModel → ChartOptionsModel with Unity. |
ChartOptionsModuleNameAttribute Class
Extends TextAttribute. Applied at assembly level to provide the module's display name.
| Member | Signature | Description |
|---|---|---|
| Constructor | ChartOptionsModuleNameAttribute() |
Default constructor. |
| Constructor | ChartOptionsModuleNameAttribute(string s) |
Overload accepting a string (parameter is unused). |
AssemblyName |
override string AssemblyName { get; } |
Returns AssemblyNames.ChartOptions.ToString(). |
GetAttributeType |
override Type GetAttributeType() |
Returns typeof(TextAttribute). |
GetAssemblyName |
override string GetAssemblyName() |
Returns the AssemblyName property value. |
ChartOptionsModuleImageAttribute Class
Extends ImageAttribute. Applied at assembly level to provide module image and categorization metadata.
| Member | Signature | Description |
|---|---|---|
| Constructor | ChartOptionsModuleImageAttribute() |
Default constructor. |
| Constructor | ChartOptionsModuleImageAttribute(string s) |
Overload accepting a string (parameter is unused). |
AssemblyImage |
override BitmapImage AssemblyImage { get; } |
Lazily loads image via AssemblyInfo.GetImage(AssemblyNames.ChartOptions.ToString()). |
AssemblyName |
override string AssemblyName { get; } |
Returns AssemblyNames.ChartOptions.ToString(). |
AssemblyGroup |
override string AssemblyGroup { get; } |
Returns eAssemblyGroups.Viewer.ToString(). |
AssemblyRegion |
override eAssemblyRegion AssemblyRegion { get; } |
Returns eAssemblyRegion.ChartOptionsRegion. |
GetAttributeType |
override Type GetAttributeType() |
Returns typeof(ImageAttribute). |
GetAssemblyImage |
override BitmapImage GetAssemblyImage() |
Returns AssemblyImage property. |
GetAssemblyName |
override string GetAssemblyName() |
Returns AssemblyName property. |
GetAssemblyGroup |
override string GetAssemblyGroup() |
Returns AssemblyGroup property. |
GetAssemblyRegion |
override eAssemblyRegion GetAssemblyRegion() |
Returns AssemblyRegion property. |
3. Invariants
- Single Instance per Attribute Type: Both
ChartOptionsModuleNameAttributeandChartOptionsModuleImageAttributeare decorated withAllowMultiple = false, ensuring only one of each can be applied to the assembly. - Fixed Assembly Name: The
AssemblyNameproperty in both attribute classes is read-only and always returnsAssemblyNames.ChartOptions.ToString(). - Fixed Group Assignment: The module is always assigned to the
Viewerassembly group. - Fixed Region Assignment: The module is always assigned to
eAssemblyRegion.ChartOptionsRegion. - Container Registration: The module always registers the same three interface-to-concrete-type mappings during initialization.
4. Dependencies
This Module Depends On:
- Prism Libraries:
Prism.Ioc,Prism.Modularity(forIModule,IContainerProvider,IContainerRegistry) - Unity:
Unity(forIUnityContainer) - WPF:
System.Windows.Media.Imaging(forBitmapImage) - DTS.Common: Likely contains
AssemblyNamesenum,eAssemblyGroupsenum,eAssemblyRegionenum, andAssemblyInfoclass. - DTS.Common.Interface: Contains
TextAttribute,ImageAttributebase classes. - DTS.Viewer.ChartOptions.Model: Contains
IChartOptionsModel,ChartOptionsModel. - Local Types:
ChartOptionsView,ChartOptionsViewModel,IChartOptionsView,IChartOptionsViewModel(referenced but not shown in this file).
What Depends On This Module:
- DTS Viewer Main Application: Uses the assembly-level attributes to discover and display this module in the UI; resolves the registered views/view-models via the container.
5. Gotchas
-
Comment Inaccuracy: The comment on line 37 states "Register View & View-Model with Unity dependency injection container as a singleton." However,
_unityContainer.RegisterType<TFrom, TTo>()without an explicitContainerControlledLifetimeManagerregisters types as transient, not singleton. The comment does not match the actual behavior. -
Unused Constructor Parameters: Both attribute classes have constructors accepting a
string sparameter that is never used. This appears to be a requirement of the attribute system (attributes require parameterless constructors or constructors with constant values), but the parameter serves no functional purpose. -
Empty
OnInitializedMethod: TheOnInitializedmethod is explicitly implemented but empty. It is unclear whether this is intentional (no initialization logic needed) or represents incomplete implementation. -
Dual Initialization Pattern: The
Initialize()method is called from withinRegisterTypes(). This is unconventional—typicallyRegisterTypeshandles registration directly. The separateInitialize()method may be a legacy pattern or intended for reuse elsewhere.