6.5 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T11:33:44.285966+00:00 | zai-org/GLM-5-FP8 | 1 | 5ade2343bf1c7a50 |
Documentation: DTS.Common.Property Module
1. Purpose
This module serves as a Prism-based plugin module for a modular WPF application. It registers property-related UI components (a view and view-model) with the Unity dependency injection container and provides assembly-level metadata (name, image, region, and group) that the main application uses to display and categorize this component. It is part of a larger plugin architecture where modules self-register at startup.
2. Public Interface
PropertyModule Class
Signature:
[Export(typeof(IModule))]
[Module(ModuleName = "Property")]
public class PropertyModule : IModule
Constructor:
public PropertyModule(IUnityContainer unityContainer)
Accepts an injected IUnityContainer instance and stores it in a readonly field.
Methods:
public void Initialize()
Registers the following type mappings with Unity (transient lifetime, not singleton despite the comment):
IPropertyView→PropertyViewIPropertyViewModel→PropertyViewModel
PropertiesNameAttribute Class
Signature:
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public class PropertiesNameAttribute : TextAttribute
Constructors:
public PropertiesNameAttribute()
public PropertiesNameAttribute(string s)
Both constructors initialize _assemblyName to the hardcoded string "PropertiesAsssembly".
Properties:
public override string AssemblyName { get; }
Returns the hardcoded assembly name.
Methods:
public override Type GetAttributeType() // Returns typeof(TextAttribute)
public override string GetAssemblyName() // Returns AssemblyName property
PropertiesImageAttribute Class
Signature:
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public class PropertiesImageAttribute : ImageAttribute
Constructors:
public PropertiesImageAttribute()
public PropertiesImageAttribute(string s)
Both constructors initialize _img via AssemblyInfo.GetImage(AssemblyNames.Property.ToString()).
Properties:
| Property | Return Type | Value |
|---|---|---|
AssemblyImage |
BitmapImage |
Loaded via AssemblyInfo.GetImage(AssemblyNames.Property.ToString()) |
AssemblyName |
string |
AssemblyNames.Property.ToString() |
AssemblyGroup |
string |
eAssemblyGroups.Viewer.ToString() |
AssemblyRegion |
eAssemblyRegion |
eAssemblyRegion.PropertyRegion |
Methods:
public override Type GetAttributeType() // Returns typeof(ImageAttribute)
public override BitmapImage GetAssemblyImage() // Returns AssemblyImage property
public override string GetAssemblyName() // Returns AssemblyName property
public override eAssemblyRegion GetAssemblyRegion() // Returns AssemblyRegion property
public override string GetAssemblyGroup() // Returns AssemblyGroup property
3. Invariants
-
Single Instance per Assembly: Both
PropertiesNameAttributeandPropertiesImageAttributeare applied at assembly level withAllowMultiple = false, ensuring exactly one instance of each per assembly. -
Module Registration Order: The
Initialize()method must be called after the Unity container is fully constructed but before any code attempts to resolveIPropertyVieworIPropertyViewModel. -
Attribute Base Class Requirements: Both attribute classes inherit from abstract base classes (
TextAttributeandImageAttributerespectively) that are not defined in this file but must exist inDTS.Common.Interfaceor another referenced assembly. -
Image Resource Availability:
AssemblyInfo.GetImage()must be able to locate an image resource keyed byAssemblyNames.Property.ToString()at the time the attribute is queried.
4. Dependencies
This Module Depends On:
| Dependency | Purpose |
|---|---|
Microsoft.Practices.Prism.Modularity |
Provides IModule interface and ModuleAttribute for plugin architecture |
Microsoft.Practices.Unity |
Provides IUnityContainer for dependency injection |
System.ComponentModel.Composition |
Provides MEF ExportAttribute |
System.Windows.Media.Imaging |
Provides BitmapImage for assembly icon |
DTS.Common.Interface |
Defines TextAttribute, ImageAttribute, IPropertyView, IPropertyViewModel |
AssemblyInfo (location unclear) |
Static utility class with GetImage() method |
AssemblyNames (enum, location unclear) |
Enum containing Property value |
eAssemblyGroups (enum, location unclear) |
Enum containing Viewer value |
eAssemblyRegion (enum, location unclear) |
Enum containing PropertyRegion value |
PropertyView (location unclear) |
Concrete type implementing IPropertyView |
PropertyViewModel (location unclear) |
Concrete type implementing IPropertyViewModel |
What Depends On This Module:
- The main application shell, which discovers and loads Prism modules via MEF exports and reads assembly-level attributes for UI display.
5. Gotchas
-
Typo in Assembly Name:
PropertiesNameAttributehardcodes_assemblyName = "PropertiesAsssembly"with three consecutive 's' characters. This may cause lookup failures if other code expects correct spelling. -
Misleading XML Comment: The constructor XML doc references
<see cref="PropertiesModule"/>but the actual class name isPropertyModule(no 's'). -
Comment Inaccuracy: The comment in
Initialize()states "Register View & View-Model... as a singleton" butRegisterTyperegisters types with transient lifetime by default. To register as singleton,ContainerControlledLifetimeManagerwould be required. -
Unused Constructor Parameters: Both attribute classes accept a
string sparameter in their constructors but completely ignore it, always using hardcoded values instead. -
Side Effects in Property Getters: The
AssemblyImageproperty getter has a side effect (assigning to_imgfield), which violates typical property getter conventions and could cause unexpected behavior if the property is accessed multiple times. -
Lazy Initialization Pattern Inconsistency: The
AssemblyName,AssemblyGroup, andAssemblyRegionproperties inPropertiesImageAttributeassign to their backing fields on every get, making them behave more like methods than properties.