Files
DP44/enriched-qwen3-coder-next/DataPRO/Modules/SystemSettings/Tables.md
2026-04-17 14:55:32 -04:00

6.0 KiB
Raw Blame History

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DataPRO/Modules/SystemSettings/Tables/TablesSettingsModule.cs
2026-04-16T04:39:15.502612+00:00 Qwen/Qwen3-Coder-Next-FP8 1 6c60f7444292529a

Tables

Documentation: TablesSettingsModule

1. Purpose

The TablesSettingsModule is a Prism module responsible for registering the view and view model for the Tables Settings UI component within the applications modular architecture. It integrates with the Unity dependency injection container to enable inversion of control (IoC) and lifecycle management for the TablesSettingsView and TablesSettingsViewModel. This module enables the Tables Settings feature to be discovered, loaded, and rendered as part of the main application shell—specifically under the Administrative section—as indicated by its associated metadata attribute.

2. Public Interface

TablesSettingsModule class

  • TablesSettingsModule(IUnityContainer unityContainer)
    Constructor that receives the Unity container via dependency injection. Stores the container for later use in type registration.

  • void Initialize()
    Registers two types as singletons in the Unity container:

    • ITablesSettingsViewTablesSettingsView
    • ITablesSettingsViewModelTablesSettingsViewModel
      This method is called both directly during module initialization and indirectly via RegisterTypes.
  • void OnInitialized(IContainerProvider containerProvider)
    Currently empty; no initialization logic is performed here.

  • void RegisterTypes(IContainerRegistry containerRegistry)
    Delegates to Initialize(), performing the same type registrations. This is part of the Prism IModule interface contract.

TablesSettingsImageAttribute class

  • TablesSettingsImageAttribute()
    Default constructor; delegates to the parameterized constructor with null.

  • TablesSettingsImageAttribute(string s)
    Constructor accepting a string argument (unused), initializes _img by calling AssemblyInfo.GetImage(AssemblyNames.TablesSettings.ToString()).

  • override eAssemblyRegion AssemblyRegion
    Property that always throws NotImplementedException.

  • override BitmapImage AssemblyImage
    Property that returns the assembly image for TablesSettings, retrieved via AssemblyInfo.GetImage(...). Caches the result in _img.

  • override Type GetAttributeType()
    Returns typeof(ImageAttribute).

  • override BitmapImage GetAssemblyImage()
    Returns the value of the AssemblyImage property.

  • override string AssemblyName
    Property that returns "TablesSettings" (via AssemblyNames.TablesSettings.ToString()). Caches in _name.

  • override string GetAssemblyName()
    Returns the value of the AssemblyName property.

  • override eAssemblyRegion GetAssemblyRegion()
    Method that always throws NotImplementedException.

  • override string AssemblyGroup
    Property that returns "Administrative" (via eAssemblyGroups.Administrative.ToString()). Caches in _group.

  • override string GetAssemblyGroup()
    Returns the value of the AssemblyGroup property.

Note

: The TablesSettingsImageAttribute inherits from ImageAttribute (not shown in source), and is applied at the assembly level via [assembly: TablesSettingsImage] (not visible in this file but implied by its usage context).

3. Invariants

  • The TablesSettingsModule must be loaded before any consumer attempts to resolve ITablesSettingsView or ITablesSettingsViewModel, since registration occurs in Initialize()/RegisterTypes().
  • The AssemblyImage and AssemblyName properties are idempotent (cached after first access), but rely on AssemblyInfo.GetImage(...) and AssemblyNames.TablesSettings.ToString() returning consistent values.
  • The AssemblyGroup is always "Administrative" (hardcoded).
  • The AssemblyRegion and GetAssemblyRegion() methods are unimplemented and will throw NotImplementedException if invoked.

4. Dependencies

Depends on (imports/uses):

  • System.ComponentModel.Composition ([Export], [Module])
  • DTS.Common (specifically AssemblyInfo, AssemblyNames, eAssemblyGroups)
  • Prism.Modularity (IModule, IContainerRegistry)
  • Prism.Ioc (IContainerProvider)
  • Unity (IUnityContainer)
  • System.Windows.Media.Imaging (BitmapImage)

Used by (consumers):

  • The Prism module loading infrastructure (via [Export(typeof(IModule))] and [Module(ModuleName = "TablesSettings")]).
  • The application shell or UI framework (via TablesSettingsImageAttribute applied at assembly level) to display the modules icon and group on the main screen.

5. Gotchas

  • AssemblyRegion and GetAssemblyRegion() are unimplemented — any code attempting to use them (e.g., for region-based routing or grouping logic) will crash with NotImplementedException.
  • The TablesSettingsImageAttribute(string) constructor accepts a parameter s that is ignored — likely legacy or placeholder.
  • Initialize() is called twice: once directly in RegisterTypes() and potentially again if Prism calls Initialize() explicitly (though Prisms IModule lifecycle typically calls RegisterTypes() first, then Initialize()). This is safe here because Unitys RegisterType<T, TImpl>() is idempotent for singleton registrations, but could be confusing.
  • The module assumes AssemblyInfo.GetImage(AssemblyNames.TablesSettings.ToString()) returns a valid BitmapImage; failure to load the image (e.g., missing resource) may cause silent failures or runtime exceptions depending on AssemblyInfos implementation.
  • No error handling or logging is present in Initialize() — registration failures (e.g., due to missing view/viewmodel types) will surface later as resolution errors.
  • No public API beyond module registration and metadata — this module does not expose domain logic or services beyond its view/viewmodel pair.