Files

59 lines
3.7 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- DataPRO/Modules/SystemSettings/DBImportExport/DBImportExportModule.cs
generated_at: "2026-04-17T16:30:18.435175+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "c80918b880933336"
---
# DBImportExport
### Purpose
This module provides database import and export functionality within the SystemSettings subsystem. It is a Prism module that registers its views (`DBImportView`, `DBExportView`) and view model (`DBViewModel`) with the Unity dependency injection container, enabling the application to display and manage database import/export operations through the modular UI framework.
### Public Interface
**DBImportExportModule** (implements `IModule`)
- `DBImportExportModule(IUnityContainer unityContainer)` - Constructor accepting a Unity container instance via dependency injection.
- `void Initialize()` - Registers types with Unity: `IDBImportView``DBImportView`, `IDBExportView``DBExportView`, `IDBViewModel``DBViewModel`.
- `void OnInitialized(IContainerProvider containerProvider)` - Empty implementation; no initialization logic executed.
- `void RegisterTypes(IContainerRegistry containerRegistry)` - Calls `Initialize()` to perform type registration.
**DBImageAttribute** (extends `ImageAttribute`)
- `DBImageAttribute()` - Default constructor.
- `DBImageAttribute(string s)` - Constructor accepting a string parameter (unused).
- `BitmapImage AssemblyImage` (getter) - Returns image retrieved via `AssemblyInfo.GetImage(AssemblyNames.DB.ToString())`.
- `string AssemblyName` (getter) - Returns assembly name string.
- `string AssemblyGroup` (getter) - Returns `eAssemblyGroups.Administrative.ToString()`.
- `Type GetAttributeType()` - Returns `typeof(ImageAttribute)`.
- `BitmapImage GetAssemblyImage()` - Returns `AssemblyImage`.
- `string GetAssemblyName()` - Returns `AssemblyName`.
- `string GetAssemblyGroup()` - Returns `AssemblyGroup`.
- `eAssemblyRegion AssemblyRegion` (getter) - Throws `NotImplementedException`.
- `eAssemblyRegion GetAssemblyRegion()` - Throws `NotImplementedException`.
### Invariants
- The `_unityContainer` field must be populated via constructor injection before `Initialize()` is called.
- Type registrations use Unity's default (transient) lifetime, not singleton, despite the comment claiming singleton registration.
- `DBImageAttribute` is restricted to assembly-level targets (`AttributeTargets.Assembly`) and cannot be applied multiple times.
### Dependencies
**Imports:**
- `DTS.Common` - Provides `AssemblyInfo`, `AssemblyNames`, `eAssemblyGroups`, `eAssemblyRegion`.
- `DTS.Common.Interface` - Provides `ImageAttribute`, view/model interfaces (`IDBImportView`, `IDBExportView`, `IDBViewModel`).
- `Prism.Modularity` - Provides `IModule`, `ModuleAttribute`.
- `Prism.Ioc` - Provides `IContainerProvider`, `IContainerRegistry`.
- `Unity` - Provides `IUnityContainer`.
- `System.ComponentModel.Composition` - Provides `ExportAttribute`.
- `System.Windows.Media.Imaging` - Provides `BitmapImage`.
**Dependents:** Not identifiable from source alone; likely consumed by the main application shell/module loader.
### Gotchas
- **BUG:** The `AssemblyName` property returns `AssemblyNames.PowerAndBattery.ToString()` instead of `AssemblyNames.DB.ToString()`. This appears to be a copy-paste error from the PowerAndBattery module.
- The `AssemblyRegion` property and `GetAssemblyRegion()` method throw `NotImplementedException` at runtime if called.
- The comment claims "singleton" registration, but `RegisterType` registers types as transient by default in Unity. Use `RegisterSingleton` or `RegisterType<TFrom, TTo>(new ContainerControlledLifetimeManager())` for true singleton behavior.
- The `DBImageAttribute(string s)` constructor parameter `s` is accepted but never used.
---