88 lines
4.0 KiB
Markdown
88 lines
4.0 KiB
Markdown
|
|
---
|
||
|
|
source_files:
|
||
|
|
- Common/DTS.CommonCore/Interface/SystemSettings/DB/IDBImportView.cs
|
||
|
|
- Common/DTS.CommonCore/Interface/SystemSettings/DB/IDBExportView.cs
|
||
|
|
- Common/DTS.CommonCore/Interface/SystemSettings/DB/IDBViewModel.cs
|
||
|
|
generated_at: "2026-04-16T12:20:53.510446+00:00"
|
||
|
|
model: "zai-org/GLM-5-FP8"
|
||
|
|
schema_version: 1
|
||
|
|
sha256: "7e29e0cdd222a5b1"
|
||
|
|
---
|
||
|
|
|
||
|
|
# Documentation: DTS.Common.Interface (DB Import/Export Views)
|
||
|
|
|
||
|
|
## 1. Purpose
|
||
|
|
|
||
|
|
This module defines the contract for database import and export functionality within the system settings domain. It provides three interfaces—`IDBImportView`, `IDBExportView`, and `IDBViewModel`—that establish the structure for view models handling file-based data transfer operations. The module abstracts the import/export workflow, allowing views to be swapped or mocked while maintaining a consistent interface for XML-based data serialization.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 2. Public Interface
|
||
|
|
|
||
|
|
### `IDBImportView`
|
||
|
|
**Signature:** `public interface IDBImportView : IBaseView { }`
|
||
|
|
|
||
|
|
A marker interface extending `IBaseView`. Defines no members of its own; exists to identify views responsible for import operations.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### `IDBExportView`
|
||
|
|
**Signature:** `public interface IDBExportView : IBaseView { }`
|
||
|
|
|
||
|
|
A marker interface extending `IBaseView`. Defines no members of its own; exists to identify views responsible for export operations.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### `IDBViewModel`
|
||
|
|
**Signature:** `public interface IDBViewModel : IBaseViewModel`
|
||
|
|
|
||
|
|
Defines the contract for a view model that orchestrates database import/export operations.
|
||
|
|
|
||
|
|
**Properties:**
|
||
|
|
|
||
|
|
| Name | Type | Access | Description |
|
||
|
|
|------|------|--------|-------------|
|
||
|
|
| `ImportView` | `IDBImportView` | get/set | Reference to the import view instance |
|
||
|
|
| `ExportView` | `IDBExportView` | get/set | Reference to the export view instance |
|
||
|
|
| `ImportFileName` | `string` | get/set | File path to import from |
|
||
|
|
| `ImportStatusText` | `string` | get/set | Status message for import operations |
|
||
|
|
| `ExportFileName` | `string` | get/set | File path to export to |
|
||
|
|
| `ExportData` | `string` | get/set | Formatted XML string to write to the export file |
|
||
|
|
| `ImportData` | `string` | get/set | Formatted XML string read from the import file |
|
||
|
|
|
||
|
|
**Methods:**
|
||
|
|
|
||
|
|
| Name | Return Type | Description |
|
||
|
|
|------|-------------|-------------|
|
||
|
|
| `Export()` | `void` | Exports the contents of `ExportData` to the file specified by `ExportFileName` |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 3. Invariants
|
||
|
|
|
||
|
|
- `IDBImportView` and `IDBExportView` must always be assignable to `IBaseView`.
|
||
|
|
- `IDBViewModel` must always be assignable to `IBaseViewModel`.
|
||
|
|
- `ExportData` and `ImportData` are expected to contain formatted XML strings (as stated in source comments).
|
||
|
|
- The `Export()` method is expected to use the current values of `ExportFileName` and `ExportData` at the time of invocation.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 4. Dependencies
|
||
|
|
|
||
|
|
**This module depends on:**
|
||
|
|
- `DTS.Common.Base` — Provides `IBaseView` and `IBaseViewModel` base interfaces.
|
||
|
|
|
||
|
|
**What depends on this module:**
|
||
|
|
- Cannot be determined from the provided source files alone. Consumers would be concrete implementations of these interfaces and any code that references `IDBViewModel`, `IDBImportView`, or `IDBExportView`.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 5. Gotchas
|
||
|
|
|
||
|
|
1. **Asymmetric API:** There is an `Export()` method defined, but no corresponding `Import()` method is present in `IDBViewModel`. Import logic must be handled elsewhere or through property binding alone.
|
||
|
|
|
||
|
|
2. **Placement uncertainty:** Source comments indicate that `ImportFileName` and `ExportFileName` properties may not belong in the view model long-term: *"we may not need this in the viewmodel if the viewmodel is capable of doing all the operations it needs to do."* This suggests potential refactoring.
|
||
|
|
|
||
|
|
3. **XML coupling:** The `ExportData` and `ImportData` properties are explicitly documented as "formatted xml string." Any implementation changing this format would break the documented contract.
|
||
|
|
|
||
|
|
4. **No validation hooks:** The interfaces define no validation methods or error handling patterns for file I/O operations. Implementers must define their own error handling strategy.
|