Files
DP44/enriched-partialglm/DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList.md
2026-04-17 14:55:32 -04:00

7.2 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList/TestSummaryListModule.cs
2026-04-16T11:06:42.997864+00:00 zai-org/GLM-5-FP8 1 b68514768022da67

Documentation: TestSummaryListModule.cs

1. Purpose

This module serves as a Prism-based module initializer for the Test Summary List feature within the DTS Viewer application. Its primary role is to register the view (TestSummaryListView) and view model (TestSummaryViewListModel) with the Unity dependency injection container, enabling the main application to discover and load this component. Additionally, it provides assembly-level metadata attributes that define the module's name, display image, region assignment, and group classification for use by the main shell's module management system.


2. Public Interface

TestSummaryListModule (Class)

Signature: public class TestSummaryListModule : IModule

A Prism module that handles registration of the Test Summary List view and view model.

Member Signature Description
Constructor TestSummaryListModule(IUnityContainer unityContainer) Accepts an injected IUnityContainer instance and stores it in _unityContainer.
Initialize public void Initialize() Registers ITestSummaryListViewTestSummaryListView and ITestSummaryListViewModelTestSummaryViewListModel with Unity.
OnInitialized public void OnInitialized(IContainerProvider containerProvider) Empty implementation (no-op).
RegisterTypes public void RegisterTypes(IContainerRegistry containerRegistry) Calls Initialize() to perform type registrations.

TestSummaryListModuleNameAttribute (Class)

Signature: public class TestSummaryListModuleNameAttribute : TextAttribute

Assembly-level attribute providing the module's name metadata.

Member Signature Description
Constructor TestSummaryListModuleNameAttribute() Default constructor; sets AssemblyName to AssemblyNames.TestSummaryList.ToString().
Constructor TestSummaryListModuleNameAttribute(string s) Overload accepting a string parameter (unused).
AssemblyName public override string AssemblyName { get; } Returns AssemblyNames.TestSummaryList.ToString().
GetAttributeType public override Type GetAttributeType() Returns typeof(TextAttribute).
GetAssemblyName public override string GetAssemblyName() Returns the AssemblyName property value.

TestSummaryListModuleImageAttribute (Class)

Signature: public class TestSummaryListModuleImageAttribute : ImageAttribute

Assembly-level attribute providing the module's image, name, group, and region metadata for display in the main application shell.

Member Signature Description
Constructor TestSummaryListModuleImageAttribute() Default constructor; initializes _img via AssemblyInfo.GetImage().
Constructor TestSummaryListModuleImageAttribute(string s) Overload accepting a string parameter (unused).
AssemblyImage public override BitmapImage AssemblyImage { get; } Lazy-loads and returns image via AssemblyInfo.GetImage(AssemblyNames.TestSummaryList.ToString()).
AssemblyName public override string AssemblyName { get; } Returns AssemblyNames.TestSummaryList.ToString().
AssemblyGroup public override string AssemblyGroup { get; } Returns eAssemblyGroups.Viewer.ToString().
AssemblyRegion public override eAssemblyRegion AssemblyRegion { get; } Returns eAssemblyRegion.TestSummaryRegion.
GetAssemblyImage public override BitmapImage GetAssemblyImage() Returns AssemblyImage.
GetAssemblyName public override string GetAssemblyName() Returns AssemblyName.
GetAssemblyGroup public override string GetAssemblyGroup() Returns AssemblyGroup.
GetAssemblyRegion public override eAssemblyRegion GetAssemblyRegion() Returns AssemblyRegion.
GetAttributeType public override Type GetAttributeType() Returns typeof(ImageAttribute).

3. Invariants

  • Module Name Consistency: The Module attribute's ModuleName property is hardcoded as "TestSummaryList" and must match the AssemblyNames.TestSummaryList enum value's string representation.
  • Single Instance per Assembly: Both assembly attributes use AllowMultiple = false, ensuring only one name and one image attribute can be applied per assembly.
  • Region Assignment: The module is always assigned to eAssemblyRegion.TestSummaryRegion.
  • Group Assignment: The module is always assigned to eAssemblyGroups.Viewer.
  • Attribute Target: Both attributes are restricted to AttributeTargets.Assembly only.

4. Dependencies

This Module Depends On:

Dependency Usage
Prism.Ioc IContainerProvider interface for OnInitialized
Prism.Modularity IModule interface and Module attribute
Unity IUnityContainer for DI registration
System.Windows.Media.Imaging BitmapImage for module icon
DTS.Common AssemblyNames enum, eAssemblyGroups enum, eAssemblyRegion enum, AssemblyInfo static class
DTS.Common.Interface TextAttribute, ImageAttribute base classes
DTS.Viewer.TestSummaryList.ViewModel ITestSummaryListViewModel, TestSummaryViewListModel
Local (same assembly) ITestSummaryListView, TestSummaryListView

What Depends On This Module:

  • The main DTS Viewer shell application (inferred from Prism modularity pattern and assembly-level metadata attributes used for module discovery)

5. Gotchas

  1. Misleading Singleton Comment: The comment on line 35 states "Register View & View-Model with Unity dependency injection container as a singleton," but RegisterType<TFrom, TTo>() registers types as transient by default in Unity, not as singletons. To register as singletons, RegisterType<TFrom, TTo>(new ContainerControlledLifetimeManager()) or RegisterSingleton<TFrom, TTo>() should be used. The actual behavior may not match the comment's intent.

  2. Unusual View Model Class Name: The concrete view model class is named TestSummaryViewListModel (line 39), which appears to be a typo or unconventional naming—typically one would expect TestSummaryViewModel. This is the actual class name in the source, not a documentation error.

  3. Redundant Initialize() Method: The Initialize() method is public and called from RegisterTypes(), but it could be inlined. Having it public allows external code to call it, which could cause duplicate registrations.

  4. Unused Constructor Parameters: Both attribute constructors accept a string s parameter that is never used in the constructor body. This appears to be boilerplate code required by the .NET attribute system for XAML or reflection usage.

  5. Lazy Initialization Side Effect: The AssemblyImage property getter has a side effect—it assigns to _img on every get. While the constructor also initializes _img, the property getter will re-fetch the image each time, potentially causing unnecessary work if called repeatedly.