5.8 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T04:45:20.865762+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 99bf820620f80499 |
GroupImport
Documentation: GroupImportModule
1. Purpose
The GroupImportModule is a Prism module responsible for registering the views and view models required for the Group Import functionality within the application’s UI. It integrates with the Unity dependency injection container to expose the necessary components (IGroupImportImportView, IGroupImportOptionsView, IGroupImportPreviewView, and IGroupImportViewModel) as singleton registrations, enabling modular, testable, and loosely coupled UI construction. Additionally, it provides assembly-level metadata via the GroupImageAttribute, which is used by the main UI to display the module’s name, group (e.g., “Prepare”), and associated icon.
2. Public Interface
GroupImportModule class
-
GroupImportModule(IUnityContainer unityContainer)
Constructor. Accepts a Unity container via dependency injection and stores it for later use in type registration. -
void Initialize()
Registers the following types as singletons in the Unity container:IGroupImportImportView→GroupImportImportViewIGroupImportOptionsView→GroupImportOptionsViewIGroupImportPreviewView→GroupImportPreviewViewIGroupImportViewModel→GroupImportViewModel
This method is called by bothPrism.Modularity.IModule.Initialize()andRegisterTypes().
-
void OnInitialized(IContainerProvider containerProvider)
Currently empty; no initialization logic beyond type registration is performed. -
void RegisterTypes(IContainerRegistry containerRegistry)
Delegates toInitialize(). (Note: Despite acceptingIContainerRegistry, it uses the injectedIUnityContainerinternally.)
GroupImageAttribute class
-
GroupImageAttribute()
Default constructor; initializes image viaAssemblyInfo.GetImage(AssemblyNames.GroupImport.ToString()). -
GroupImageAttribute(string s)
Constructor accepting a string argument (unused); initializes image identically to the default constructor. -
override BitmapImage AssemblyImage
Returns aBitmapImageloaded viaAssemblyInfo.GetImage(AssemblyNames.GroupImport.ToString()). -
override string AssemblyName
Returns"GroupImport"(fromAssemblyNames.GroupImport.ToString()). -
override string AssemblyGroup
Returns"Prepare"(fromeAssemblyGroups.Prepare.ToString()). -
override eAssemblyRegion AssemblyRegion
ThrowsNotImplementedException. Not implemented. -
override Type GetAttributeType()
Returnstypeof(ImageAttribute). -
override BitmapImage GetAssemblyImage()
Returns the value ofAssemblyImage. -
override string GetAssemblyName()
Returns the value ofAssemblyName. -
override string GetAssemblyGroup()
Returns the value ofAssemblyGroup. -
override eAssemblyRegion GetAssemblyRegion()
ThrowsNotImplementedException. Not implemented.
3. Invariants
- The
GroupImportModulemust be initialized after the Unity container is available (via DI), and before any views/view models are resolved. - All registered types (
IGroupImport*View,IGroupImportViewModel) are registered as singletons (default Unity lifetime). GroupImageAttributeis applied at the assembly level (via[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]), and only one instance per assembly is allowed.AssemblyImage,AssemblyName, andAssemblyGroupare computed at runtime using static methods (AssemblyInfo.GetImage,AssemblyNames.GroupImport,eAssemblyGroups.Prepare). Their values depend on external definitions inDTS.Commonand must be consistent.AssemblyRegionandGetAssemblyRegion()are not implemented and will throwNotImplementedExceptionif invoked.
4. Dependencies
Depends on
DTS.Common(specificallyAssemblyInfo,AssemblyNames,eAssemblyGroups)Prism.Modularity(IModule,IContainerProvider,IContainerRegistry)Unity(IUnityContainer)System.Windows.Media.Imaging(BitmapImage)
Depended on by
- The Prism bootstrapper/container infrastructure (via
[Export(typeof(IModule))]and[Module(...)]attributes). - UI components that resolve
IGroupImport*VieworIGroupImportViewModel. - The main application shell or module catalog system that consumes
GroupImageAttributeto display module metadata.
5. Gotchas
RegisterTypesdoes not useIContainerRegistry: Despite implementingIContainerRegistry, the method ignores it and callsInitialize(), which uses the injectedIUnityContainer. This is inconsistent with Prism’s recommended pattern (whereRegisterTypesshould usecontainerRegistry) and may cause confusion or breakage if the module is used in a non-Unity Prism setup.AssemblyRegionis unimplemented: BothAssemblyRegionandGetAssemblyRegion()throwNotImplementedException. If the UI or module loader relies on this property, it will crash at runtime.- Redundant constructor: The
GroupImageAttribute(string s)constructor accepts a parameter that is never used. - No validation of image loading:
AssemblyInfo.GetImage(...)may returnnullif the image resource is missing; this is not handled, potentially leading toNullReferenceExceptionat runtime when the image is rendered. - No documentation on view/view model responsibilities: While the types are registered, their roles (e.g., what
IGroupImportImportViewvsIGroupImportPreviewViewdoes) are not described here and must be inferred from their implementations.
None identified beyond the above.