6.5 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T14:12:34.427071+00:00 | zai-org/GLM-5-FP8 | 1 | 5ade2343bf1c7a50 |
Documentation: DTS.Common.Property.PropertyModule
1. Purpose
This module serves as the Prism module initializer for the Property component within the DTS application. It registers the Property view and view-model with the Unity dependency injection container, enabling the Property UI component to be dynamically loaded and displayed in the application's modular architecture. The module also defines assembly-level metadata attributes (PropertiesNameAttribute and PropertiesImageAttribute) that provide display information (name, image, region, group) used by the main shell to present this module as an available component to users.
2. Public Interface
PropertyModule Class
Signature:
[Export(typeof(IModule))]
[Module(ModuleName = "Property")]
public class PropertyModule : IModule
| Member | Signature | Description |
|---|---|---|
| Constructor | public PropertyModule(IUnityContainer unityContainer) |
Accepts an injected Unity container reference for DI registration. |
Initialize() |
public void Initialize() |
Registers IPropertyView → PropertyView and IPropertyViewModel → PropertyViewModel with the Unity container (transient lifetime, not singleton despite the comment). |
PropertiesNameAttribute Class
Signature:
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public class PropertiesNameAttribute : TextAttribute
| Member | Signature | Description |
|---|---|---|
| Default Constructor | public PropertiesNameAttribute() |
Initializes with no parameters. |
| Parameterized Constructor | public PropertiesNameAttribute(string s) |
Accepts a string parameter (which is ignored). |
AssemblyName |
public override string AssemblyName { get; } |
Returns hardcoded value "PropertiesAsssembly". |
GetAttributeType() |
public override Type GetAttributeType() |
Returns typeof(TextAttribute). |
GetAssemblyName() |
public override string GetAssemblyName() |
Returns the AssemblyName property value. |
PropertiesImageAttribute Class
Signature:
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public class PropertiesImageAttribute : ImageAttribute
| Member | Signature | Description |
|---|---|---|
| Default Constructor | public PropertiesImageAttribute() |
Initializes with no parameters. |
| Parameterized Constructor | public PropertiesImageAttribute(string s) |
Accepts a string parameter (which is ignored). |
AssemblyImage |
public override BitmapImage AssemblyImage { get; } |
Retrieves image via AssemblyInfo.GetImage(AssemblyNames.Property.ToString()). |
AssemblyName |
public override string AssemblyName { get; } |
Returns AssemblyNames.Property.ToString(). |
AssemblyGroup |
public override string AssemblyGroup { get; } |
Returns eAssemblyGroups.Viewer.ToString(). |
AssemblyRegion |
public override eAssemblyRegion AssemblyRegion { get; } |
Returns eAssemblyRegion.PropertyRegion. |
GetAttributeType() |
public override Type GetAttributeType() |
Returns typeof(ImageAttribute). |
GetAssemblyImage() |
public override BitmapImage GetAssemblyImage() |
Returns the AssemblyImage property. |
GetAssemblyName() |
public override string GetAssemblyName() |
Returns the AssemblyName property. |
GetAssemblyRegion() |
public override eAssemblyRegion GetAssemblyRegion() |
Returns the AssemblyRegion property. |
GetAssemblyGroup() |
public override string GetAssemblyGroup() |
Returns the AssemblyGroup property. |
3. Invariants
- Single Instance per Assembly: Both
PropertiesNameAttributeandPropertiesImageAttributeare applied at assembly level withAllowMultiple = false, ensuring only one instance of each exists per assembly. - Module Name: The module is registered with the fixed name
"Property"via the[Module]attribute. - Registration Lifetime: The
RegisterTypecalls inInitialize()register types with transient (not singleton) lifetime. The code comment claims singleton registration, butRegisterTypewithout aContainerControlledLifetimeManagercreates new instances per resolve. - Attribute Parameter Ignored: Both attribute classes accept a
string sparameter in their constructors, but this value is never used.
4. Dependencies
This Module Depends On:
System- Core .NET frameworkSystem.ComponentModel.Composition- MEF for module exportSystem.Windows.Media.Imaging-BitmapImagefor assembly imageMicrosoft.Practices.Prism.Modularity-IModuleinterface and[Module]attributeMicrosoft.Practices.Unity-IUnityContainerfor DIDTS.Common.Interface- DefinesIPropertyView,IPropertyViewModel,TextAttribute,ImageAttribute,AssemblyNames,eAssemblyGroups,eAssemblyRegion,AssemblyInfo(inferred from usage)
What Depends On This Module:
- The main application shell (loads this module via Prism's module catalog)
- The main UI (uses assembly attributes to display module metadata)
5. Gotchas
-
Typo in Assembly Name:
PropertiesNameAttribute._assemblyNameis hardcoded to"PropertiesAsssembly"(note the triple 's': "Asss" instead of "Asse"). This may cause display or lookup issues. -
Misleading XML Comment: The constructor's XML documentation references
<see cref="PropertiesModule"/>, but the actual class name isPropertyModule(singular "Property", not "Properties"). -
Misleading Registration Comment: The comment in
Initialize()states "Register View & View-Model... as a singleton", butRegisterType<TFrom, TTo>()without a lifetime manager registers types as transient, not singleton. To achieve singleton behavior,RegisterType<TFrom, TTo>(new ContainerControlledLifetimeManager())would be required. -
Property Getters with Side Effects: The
AssemblyImageproperty getter inPropertiesImageAttributehas a side effect—it assigns to the private_imgfield. This violates typical property getter conventions and could cause unexpected behavior if the property is accessed multiple times. -
Ignored Constructor Parameters: Both attribute classes have constructors accepting a
string sparameter that is completely ignored. This is confusing and potentially dead code.