--- source_files: - DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.GraphList/GraphListModule.cs - DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.GraphList/ExportGraphListModule.cs generated_at: "2026-04-16T13:42:43.875292+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "267c5c22d55f0847" --- # Documentation: GraphList and ExportGraphList Modules ## 1. Purpose This documentation covers two related Prism modules within the DTS Viewer application: `GraphListModule` and `ExportGraphListModule`. Both modules serve as plugin-like components that register their respective views and view models with the Unity dependency injection container at application startup. They expose assembly metadata (name, image, group, region) through custom attributes, enabling the main application shell to discover and display them as available components. The modules appear to provide graph visualization/listing functionality, with the export variant likely offering a specialized view for exporting graph data. --- ## 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)` | Implements `IModule.RegisterTypes`. Delegates to `Initialize()`. | | `OnInitialized` | `void OnInitialized(IContainerProvider containerProvider)` | Implements `IModule.OnInitialized`. Currently empty (no-op). | | `Initialize` | `void Initialize()` | Registers `IGraphMainView` → `GraphMainView` and `IGraphMainViewModel` → `GraphMainViewModel` with the Unity container. | ### GraphListNameAttribute Class **Namespace:** `DTS.Viewer.GraphList` | Member | Signature | Description | |--------|-----------|-------------| | Constructor | `GraphListNameAttribute()` | Default constructor. | | Constructor | `GraphListNameAttribute(string s)` | Overloaded constructor accepting a string parameter (unused). Sets `_assemblyName` to `AssemblyNames.GraphList.ToString()`. | | `AssemblyName` | `override string AssemblyName { get; }` | Returns the stored assembly name. | | `GetAttributeType` | `override Type GetAttributeType()` | Returns `typeof(TextAttribute)`. | | `GetAssemblyName` | `override string GetAssemblyName()` | Returns `AssemblyName` property value. | ### GraphListImageAttribute Class **Namespace:** `DTS.Viewer.GraphList` | Member | Signature | Description | |--------|-----------|-------------| | Constructor | `GraphListImageAttribute()` | Default constructor. | | Constructor | `GraphListImageAttribute(string s)` | Overloaded constructor. Loads image via `AssemblyInfo.GetImage(AssemblyNames.GraphList.ToString())`. | | `AssemblyImage` | `override BitmapImage AssemblyImage { get; }` | Lazy-loads and returns the assembly image. | | `AssemblyName` | `override string AssemblyName { get; }` | Returns `AssemblyNames.GraphList.ToString()`. | | `AssemblyGroup` | `override string AssemblyGroup { get; }` | Returns `eAssemblyGroups.Viewer.ToString()`. | | `AssemblyRegion` | `override eAssemblyRegion AssemblyRegion { get; }` | Returns `eAssemblyRegion.GraphListRegion`. | | `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. | --- ### ExportGraphListModule Class **Namespace:** `DTS.Viewer.Export` | Member | Signature | Description | |--------|-----------|-------------| | Constructor | `ExportGraphListModule(IUnityContainer unityContainer)` | Accepts an injected Unity container instance and stores it in `_unityContainer`. | | `RegisterTypes` | `void RegisterTypes(IContainerRegistry containerRegistry)` | Implements `IModule.RegisterTypes`. Delegates to `Initialize()`. | | `OnInitialized` | `void OnInitialized(IContainerProvider containerProvider)` | Implements `IModule.OnInitialized`. Currently empty (no-op). | | `Initialize` | `void Initialize()` | Registers `IExportGraphMainView` → `ExportGraphMainView` and `IExportGraphMainViewModel` → `ExportGraphMainViewModel` with the Unity container. | ### ExportGraphListNameAttribute Class **Namespace:** `DTS.Viewer.Export` | Member | Signature | Description | |--------|-----------|-------------| | Constructor | `ExportGraphListNameAttribute()` | Default constructor. | | Constructor | `ExportGraphListNameAttribute(string s)` | Overloaded constructor accepting a string parameter (unused). Sets `_assemblyName` to `AssemblyNames.GraphList.ToString()`. | | `AssemblyName` | `override string AssemblyName { get; }` | Returns the stored assembly name. | | `GetAttributeType` | `override Type GetAttributeType()` | Returns `typeof(TextAttribute)`. | | `GetAssemblyName` | `override string GetAssemblyName()` | Returns `AssemblyName` property value. | ### ExportGraphListImageAttribute Class **Namespace:** `DTS.Viewer.Export` | Member | Signature | Description | |--------|-----------|-------------| | Constructor | `ExportGraphListImageAttribute()` | Default constructor. | | Constructor | `ExportGraphListImageAttribute(string s)` | Overloaded constructor. Loads image via `AssemblyInfo.GetImage(AssemblyNames.GraphList.ToString())`. | | `AssemblyImage` | `override BitmapImage AssemblyImage { get; }` | Lazy-loads and returns the assembly image. | | `AssemblyName` | `override string AssemblyName { get; }` | Returns `AssemblyNames.GraphList.ToString()`. | | `AssemblyGroup` | `override string AssemblyGroup { get; }` | Returns `eAssemblyGroups.Viewer.ToString()`. | | `AssemblyRegion` | `override eAssemblyRegion AssemblyRegion { get; }` | Returns `eAssemblyRegion.GraphListRegion`. | | `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 - **Module Naming Convention:** `GraphListModule` has `ModuleName = "GraphList"`; `ExportGraphListModule` has `ModuleName = "ExportGraphList"`. - **Attribute Application:** Both `GraphListNameAttribute`/`GraphListImageAttribute` and `ExportGraphListNameAttribute`/`ExportGraphListImageAttribute` are applied at assembly level with `AllowMultiple = false`. - **Registration Pattern:** Both modules register interface-to-concrete-type mappings (view and view model) via `RegisterType()`. - **Assembly Name Consistency:** Both attribute families return `AssemblyNames.GraphList.ToString()` for `AssemblyName`, despite `ExportGraphListModule` residing in a different namespace (`DTS.Viewer.Export`). - **Region Assignment:** Both modules declare `eAssemblyRegion.GraphListRegion` as their target region. - **Group Assignment:** Both modules declare `eAssemblyGroups.Viewer` as their assembly group. --- ## 4. Dependencies ### External Dependencies (Imports) | Dependency | Usage | |------------|-------| | `System` | Core .NET types (`Type`, `AttributeUsage`, `AttributeTargets`). | | `System.Windows.Media.Imaging` | `BitmapImage` for assembly images. | | `DTS.Common` | `AssemblyNames`, `eAssemblyGroups`, `eAssemblyRegion` enums; `AssemblyInfo` utility class. | | `DTS.Common.Interface` | `TextAttribute`, `ImageAttribute` base classes. | | `Prism.Ioc` | `IContainerProvider`, `IContainerRegistry` interfaces. | | `Prism.Modularity` | `IModule` interface, `ModuleAttribute`. | | `Unity` | `IUnityContainer` for dependency injection. | ### Internal Dependencies (Inferred) | Dependency | Reason | |------------|--------| | `GraphMainView` | Concrete view class registered by `GraphListModule`. | | `GraphMainViewModel` | Concrete view model class registered by `GraphListModule`. | | `IGraphMainView` | Interface registered by `GraphListModule`. | | `IGraphMainViewModel` | Interface registered by `GraphListModule`. | | `ExportGraphMainView` | Concrete view class registered by `ExportGraphListModule`. | | `ExportGraphMainViewModel` | Concrete view model class registered by `ExportGraphListModule`. | | `IExportGraphMainView` | Interface registered by `ExportGraphListModule`. | | `IExportGraphMainViewModel` | Interface registered by `ExportGraphListModule`. | ### Consumers (Inferred) - The main application shell that discovers and loads Prism modules. - Any code that reflects over assemblies looking for `TextAttribute` or `ImageAttribute` metadata. --- ## 5. Gotchas 1. **Duplicate Assembly Name:** `ExportGraphListModule` uses `AssemblyNames.GraphList.ToString()` for its `AssemblyName` property, identical to `GraphListModule`. This may cause ambiguity if the application shell uses assembly name to uniquely identify modules. It is unclear whether this is intentional (shared identity) or a bug. 2. **Shared Region:** Both modules target `eAssemblyRegion.GraphListRegion`. If the shell only supports one view per region, one module may overwrite or conflict with the other. 3. **Unused Constructor Parameter:** Both `*NameAttribute` and `*ImageAttribute` constructors accept a `string s` parameter that is never used. The parameter is ignored in all implementations. 4. **Redundant Getter Side Effects:** In `*ImageAttribute` classes, the `AssemblyImage` getter has a side effect: it assigns `_img` before returning it. This means `_img` is re-fetched from `AssemblyInfo.GetImage()` on every access, potentially causing unnecessary I/O or memory allocation if called repeatedly. 5. **Empty `OnInitialized`:** Both modules implement `OnInitialized` as a no-op. If module initialization logic is expected here, it is missing. 6. **`Initialize()` Called from `RegisterTypes()`:** The `Initialize()` method is called within `RegisterTypes()`, which is non-standard for Prism modules. Typically, type registration happens in `RegisterTypes()` and runtime initialization in `OnInitialized()`. This pattern works but conflates registration with initialization. 7. **Missing Singleton Registration:** The comments indicate "Register View & View-Model... as a singleton," but `RegisterType` is used without `ContainerControlledLifetimeManager`, which registers types as transient (new instance per resolve) by default in Unity. If singleton behavior is intended, this appears to be incorrect.