--- source_files: - Common/DTS.Common/Events/Database/DbStatusEvent.cs generated_at: "2026-04-17T16:10:34.394598+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "58b4a0b43cbc1077" --- # Database ### Purpose This module provides an event mechanism for communicating database switch operations and their outcomes throughout the application. It supports reporting various failure scenarios during database migration/switch operations (remote connection failures, backup failures, copy failures, restore failures) as well as successful completion, enabling the application to respond appropriately to database state transitions. ### Public Interface **`DbStatusEvent`** - Signature: `public class DbStatusEvent : PubSubEvent` - Description: A Prism `PubSubEvent` that carries a `DbStatusArg` payload. Used to notify the application when a database switch event has occurred. **`DbStatusArg`** - Signature: `public class DbStatusArg` - Description: Argument class encapsulating the status and optional exception details for a database operation. - **`EventTypes`** (nested enum): Defines possible operation outcomes: - `FailedToConnectToRemote` - `FailedToBackupLocal` - `FailedToCopy` - `FailedToRestoreLocal` - `FailedToBackupLocalFileNotFound` - `Complete` - `LegacyStatus` - **`Status`** property: `EventTypes` (getter only) - The status type of the operation. - **`Exception`** property: `Exception` (getter only) - The exception associated with a failure, if any. - **Constructor**: `DbStatusArg(EventTypes error, Exception exception)` - Initializes a new instance with the specified status and exception. ### Invariants - `Status` is immutable after construction (get-only property). - `Exception` is immutable after construction (get-only property). - `Exception` may be `null` for non-error statuses (e.g., `Complete`), though this is not enforced by the constructor. ### Dependencies - **Depends on**: `System` (for `Exception` type), `Prism.Events` (for `PubSubEvent` base class). - **Depended on by**: Not determinable from source alone; consumers would subscribe to or publish this event via Prism