5.8 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T13:43:35.728588+00:00 | zai-org/GLM-5-FP8 | 1 | b6bfcd5e53808ea8 |
Documentation: DTS.Viewer.Graph Module
1. Purpose
This module serves as the Prism module definition for the DTS.Viewer.Graph component within the DTS Viewer application. Its primary role is to register Graph-related views and view models with the Unity dependency injection container during application startup. Additionally, it defines assembly-level attributes (GraphNameAttribute, GraphImageAttribute) that provide metadata—such as the assembly name, display image, and region assignment—used by the main application shell to identify and display the Graph module.
2. Public Interface
Class: GraphModule
Implements Prism.Modularity.IModule. It is the entry point for the module's configuration.
GraphModule(IUnityContainer unityContainer)- Constructor that accepts an
IUnityContainerinstance via dependency injection and stores it in a readonly field.
- Constructor that accepts an
void RegisterTypes(IContainerRegistry containerRegistry)- Implementation of the
IModuleinterface. It invokes theInitialize()method to perform type registrations. Note that it ignores the passedIContainerRegistryand uses the injectedIUnityContainerinstead.
- Implementation of the
void OnInitialized(IContainerProvider containerProvider)- Implementation of the
IModuleinterface. Currently contains no implementation logic.
- Implementation of the
void Initialize()- Registers types with the Unity container. It maps interfaces to concrete implementations for the following pairs:
IGraphView→GraphViewIGraphViewModel→GraphViewModelITestDataSeriesView→TestDataSeriesViewITestDataSeriesViewModel→TestDataSeriesViewModel
- Registers types with the Unity container. It maps interfaces to concrete implementations for the following pairs:
Class: GraphNameAttribute
Inherits from DTS.Common.Interface.TextAttribute. Applied at the assembly level to provide the module's name.
GraphNameAttribute()- Default constructor. Initializes the internal
_assemblyNamefield usingAssemblyNames.Graph.ToString().
- Default constructor. Initializes the internal
string AssemblyName(Property)- Returns the stored assembly name string.
Type GetAttributeType()- Returns
typeof(TextAttribute).
- Returns
string GetAssemblyName()- Returns the
AssemblyNameproperty value.
- Returns the
Class: GraphImageAttribute
Inherits from DTS.Common.Interface.ImageAttribute. Applied at the assembly level to provide display metadata.
BitmapImage AssemblyImage(Property)- Gets the module's image by calling
AssemblyInfo.GetImage(AssemblyNames.Graph.ToString()).
- Gets the module's image by calling
string AssemblyName(Property)- Returns
AssemblyNames.Graph.ToString().
- Returns
string AssemblyGroup(Property)- Returns
eAssemblyGroups.Viewer.ToString().
- Returns
eAssemblyRegion AssemblyRegion(Property)- Returns
eAssemblyRegion.GraphRegion.
- Returns
BitmapImage GetAssemblyImage(),string GetAssemblyName(),string GetAssemblyGroup(),eAssemblyRegion GetAssemblyRegion()- Accessor methods returning the values of their corresponding properties described above.
3. Invariants
- Container Consistency: The module relies strictly on
IUnityContainerfor registration, despiteRegisterTypesproviding a genericIContainerRegistry. - Metadata Constants: The
AssemblyNameis always derived from theAssemblyNames.Graphenum value. TheAssemblyGroupis alwayseAssemblyGroups.Viewer, and theAssemblyRegionis alwayseAssemblyRegion.GraphRegion. - Attribute Usage: Both
GraphNameAttributeandGraphImageAttributeare decorated withAttributeUsage(AttributeTargets.Assembly, AllowMultiple = false), ensuring single-instance application at the assembly level.
4. Dependencies
Internal Dependencies (Inferred)
DTS.Common: Used forAssemblyNames,eAssemblyGroups,eAssemblyRegion, andAssemblyInfo.DTS.Common.Interface: DefinesTextAttribute,ImageAttribute, and the view/view model interfaces (IGraphView,IGraphViewModel,ITestDataSeriesView,ITestDataSeriesViewModel).- Local Types: The module registers but does not define
GraphView,GraphViewModel,TestDataSeriesView, andTestDataSeriesViewModel.
External Dependencies
Prism.Ioc: ProvidesIContainerProvider,IContainerRegistry.Prism.Modularity: ProvidesIModule,ModuleAttribute.Unity: ProvidesIUnityContainer.System.Windows.Media.Imaging: ProvidesBitmapImage.
5. Gotchas
- Bypassing Prism Abstractions: The
RegisterTypesmethod receives anIContainerRegistryparameter (standard Prism abstraction) but completely ignores it. Instead, it callsInitialize(), which uses the constructor-injectedIUnityContainer. This tightly couples the module to the Unity container, defeating the purpose of Prism's container-agnosticIContainerRegistryinterface. - Dead Code: The
Initializemethod contains commented-out registrations forITestDataViewandITestDataViewModel. This suggests incomplete refactoring or deprecated features that have not been removed. - Unused Constructor Parameters: The constructors for
GraphNameAttribute(string s)andGraphImageAttribute(string s)accept a string parametersthat is never used. The default constructors call these overloaded constructors withnull, and the logic inside them ignores the argument entirely. - Property Side-Effects: In
GraphImageAttribute, the getter forAssemblyImageperforms logic (_img = AssemblyInfo.GetImage...) rather than simply returning a cached value. While likely harmless, this means the image fetching logic runs every time the property is accessed, rather than just once in the constructor.