Files
2026-04-17 14:55:32 -04:00

2.8 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.CommonCore/Events/Database/DbStatusEvent.cs
2026-04-17T16:40:13.623179+00:00 zai-org/GLM-5-FP8 1 d12f546e7f17ce45

Documentation: DbStatusEvent.cs

1. Purpose

This module provides an event mechanism for broadcasting database status changes within the application, specifically related to database switch operations. It exists to decouple database operation outcomes from their consumers, allowing loosely-coupled components to react to database synchronization, backup, restore, and connection failures. The module implements the Prism event aggregation pattern via CompositePresentationEvent<T>.


2. Public Interface

DbStatusEvent

Signature: public class DbStatusEvent : CompositePresentationEvent<DbStatusArg>

A concrete event class that serves as a typed event carrier in the Prism event aggregation system. It carries DbStatusArg as its payload. This class has no additional members beyond its inherited functionality.


DbStatusArg

Signature: public class DbStatusArg

An immutable payload class containing the details of a database status event.

Constructor:

public DbStatusArg(EventTypes error, Exception exception)

Constructs a new instance with the specified status type and optional exception.

Properties:

Property Type Access Description
Status EventTypes Get only The type of status event that occurred
Exception Exception Get only An associated exception, if any

DbStatusArg.EventTypes

Signature: public enum EventTypes

Defines the possible database operation outcomes.

Value Implied Meaning
FailedToConnectToRemote Connection to remote database failed
FailedToBackupLocal Local database backup operation failed
FailedToCopy Copy operation failed
FailedToRestoreLocal Local database restore operation failed
FailedToBackupLocalFileNotFound Backup failed due to missing file
Complete Operation completed successfully
LegacyStatus Unclear from source alone

3. Invariants

  • Immutability: DbStatusArg instances are immutable after construction. The Status and Exception properties have no setters.
  • Non-null Status: The Status property is always assigned via the constructor; it cannot be null since EventTypes is a value type enum.
  • Event payload type: DbStatusEvent always carries DbStatusArg as its payload type, enforced by the generic base class.

4. Dependencies

This module depends on:

  • System (standard .NET namespace for Exception type)
  • Microsoft.Practices.Prism.Events (provides CompositePresentationEvent<T> for event aggregation)

What depends on this module:

  • Cannot be