8.6 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T11:04:41.132033+00:00 | zai-org/GLM-5-FP8 | 1 | 267c5c22d55f0847 |
Documentation: GraphList and ExportGraphList Modules
1. Purpose
This documentation covers two Prism modules within the DTS Viewer application: GraphListModule and ExportGraphListModule. Both modules follow an identical architectural pattern for registering views and view-models with the Unity dependency injection container. They provide assembly-level metadata (name, image, group, and region) via custom attributes, enabling the main application shell to discover and display these components as available modules. The GraphListModule provides the primary graph list visualization, while ExportGraphListModule appears to provide an export-oriented variant of the same functionality.
2. Public Interface
GraphListModule Class
Namespace: DTS.Viewer.GraphList
| Member | Signature | Description |
|---|---|---|
| Constructor | GraphListModule(IUnityContainer unityContainer) |
Accepts an injected Unity container instance and stores it in _unityContainer. |
RegisterTypes |
void RegisterTypes(IContainerRegistry containerRegistry) |
Calls Initialize() to register types with the container. |
OnInitialized |
void OnInitialized(IContainerProvider containerProvider) |
Empty implementation (no post-initialization logic). |
Initialize |
void Initialize() |
Registers IGraphMainView → GraphMainView and IGraphMainViewModel → GraphMainViewModel with Unity. |
GraphListNameAttribute Class
Namespace: DTS.Viewer.GraphList
Base Class: TextAttribute
| Member | Signature | Description |
|---|---|---|
| Constructor | GraphListNameAttribute() |
Default constructor; initializes _assemblyName to AssemblyNames.GraphList.ToString(). |
| Constructor | GraphListNameAttribute(string s) |
Overloaded constructor; parameter s is unused. |
AssemblyName |
string AssemblyName { get; } |
Returns _assemblyName. |
GetAttributeType |
Type GetAttributeType() |
Returns typeof(TextAttribute). |
GetAssemblyName |
string GetAssemblyName() |
Returns AssemblyName. |
GraphListImageAttribute Class
Namespace: DTS.Viewer.GraphList
Base Class: ImageAttribute
| Member | Signature | Description |
|---|---|---|
| Constructor | GraphListImageAttribute() |
Initializes _img via AssemblyInfo.GetImage(). |
| Constructor | GraphListImageAttribute(string s) |
Parameter s is unused; initializes _img. |
AssemblyImage |
BitmapImage AssemblyImage { get; } |
Lazy-loads image via AssemblyInfo.GetImage(AssemblyNames.GraphList.ToString()). |
AssemblyName |
string AssemblyName { get; } |
Returns AssemblyNames.GraphList.ToString(). |
AssemblyGroup |
string AssemblyGroup { get; } |
Returns eAssemblyGroups.Viewer.ToString(). |
AssemblyRegion |
eAssemblyRegion AssemblyRegion { get; } |
Returns eAssemblyRegion.GraphListRegion. |
GetAttributeType |
Type GetAttributeType() |
Returns typeof(ImageAttribute). |
GetAssemblyImage |
BitmapImage GetAssemblyImage() |
Returns AssemblyImage. |
GetAssemblyName |
string GetAssemblyName() |
Returns AssemblyName. |
GetAssemblyGroup |
string GetAssemblyGroup() |
Returns AssemblyGroup. |
GetAssemblyRegion |
eAssemblyRegion GetAssemblyRegion() |
Returns AssemblyRegion. |
ExportGraphListModule Class
Namespace: DTS.Viewer.Export
| Member | Signature | Description |
|---|---|---|
| Constructor | ExportGraphListModule(IUnityContainer unityContainer) |
Accepts an injected Unity container instance. |
RegisterTypes |
void RegisterTypes(IContainerRegistry containerRegistry) |
Calls Initialize(). |
OnInitialized |
void OnInitialized(IContainerProvider containerProvider) |
Empty implementation. |
Initialize |
void Initialize() |
Registers IExportGraphMainView → ExportGraphMainView and IExportGraphMainViewModel → ExportGraphMainViewModel. |
ExportGraphListNameAttribute Class
Namespace: DTS.Viewer.Export
Base Class: TextAttribute
Identical structure to GraphListNameAttribute, returning AssemblyNames.GraphList.ToString().
ExportGraphListImageAttribute Class
Namespace: DTS.Viewer.Export
Base Class: ImageAttribute
Identical structure to GraphListImageAttribute, with the same values for AssemblyName, AssemblyGroup, and AssemblyRegion.
3. Invariants
-
Constructor Injection Required: Both modules require a non-null
IUnityContainerinstance to be injected at construction time. The container is stored but never null-checked. -
Single Instance per Assembly: Both
[GraphListNameAttribute]and[GraphListImageAttribute](and their Export variants) are decorated withAllowMultiple = false, enforcing exactly one instance per assembly. -
Registration is Non-Singleton: Both modules use
RegisterType<Interface, Implementation>()without specifying a container-controlled lifetime, meaning each resolution creates a new instance (transient lifestyle). -
Initialize Called from RegisterTypes: The
Initialize()method is explicitly called withinRegisterTypes(), notOnInitialized(). This ordering is intentional per Prism's module lifecycle. -
Fixed Assembly Metadata:
- Both modules return
AssemblyNames.GraphList.ToString()as their assembly name. - Both return
eAssemblyGroups.Viewer.ToString()as their group. - Both return
eAssemblyRegion.GraphListRegionas their region.
- Both modules return
4. Dependencies
External Dependencies (Imports)
| Namespace | Purpose |
|---|---|
System |
Core .NET types (Type, AttributeUsage, AttributeTargets). |
System.Windows.Media.Imaging |
BitmapImage for assembly imagery. |
Prism.Ioc |
IContainerProvider, IContainerRegistry for Prism DI abstraction. |
Prism.Modularity |
IModule, ModuleAttribute for modular composition. |
Unity |
IUnityContainer for Unity-specific DI operations. |
Internal Dependencies (Inferred)
| Namespace | Usage |
|---|---|
DTS.Common |
AssemblyNames enum, eAssemblyGroups enum, eAssemblyRegion enum, AssemblyInfo static class. |
DTS.Common.Interface |
TextAttribute, ImageAttribute base classes. |
DTS.Viewer.GraphList (local) |
GraphMainView, GraphMainViewModel, IGraphMainView, IGraphMainViewModel. |
DTS.Viewer.Export (local) |
ExportGraphMainView, ExportGraphMainViewModel, IExportGraphMainView, IExportGraphMainViewModel. |
Consumers
Unknown from source alone. The modules are discovered and loaded by a Prism-based shell application that scans for IModule implementations and assembly attributes.
5. Gotchas
-
Duplicate Assembly Name Values: Both
GraphListNameAttributeandExportGraphListNameAttributereturnAssemblyNames.GraphList.ToString(). This may cause ambiguity if the shell application uses assembly name as a unique identifier. It is unclear whether this is intentional (shared identity) or a copy-paste oversight. -
Duplicate Region Assignment: Both modules declare
eAssemblyRegion.GraphListRegion. If the shell uses region-based navigation, both views may attempt to load into the same region, potentially causing conflicts or overwrites. -
Redundant Image Initialization: In
GraphListImageAttributeandExportGraphListImageAttribute, the_imgfield is assigned in both the constructor and theAssemblyImagegetter. The getter reassigns_imgon every access, defeating the purpose of the constructor initialization. -
Unused Constructor Parameter: Both attribute classes accept a
string sparameter in an overloaded constructor but never use it. The ReSharper suppression comment// ReSharper disable UnusedParameter.Localacknowledges this but does not explain the design rationale. -
Empty OnInitialized: Both modules leave
OnInitialized()empty. If module initialization logic is expected here, it will not execute. The actual registration happens inRegisterTypes()→Initialize(). -
No Lifetime Management: The
RegisterTypecalls do not specifyContainerControlledLifetimeManager, meaning views and view-models are transient. If singleton behavior is expected (as suggested by the comment "Register View & View-Model with Unity dependency injection container as a singleton"), the implementation does not match the intent.