6.2 KiB
6.2 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-17T16:03:43.915495+00:00 | zai-org/GLM-5-FP8 | 1 | 41cfe90dcb841b35 |
Database
Purpose
This module defines the contract layer for database management operations within the DTS system, specifically handling database copying, switching between remote and local databases, and displaying database connection status. It provides the View and ViewModel interfaces that enable a Model-View-ViewModel (MVVM) architecture for database-related UI components, allowing applications to transfer remote databases to local instances and manage connection states.
Public Interface
IDatabaseCopyView
interface IDatabaseCopyView : IBaseView- Marker interface for database copy views. No members defined.
IDatabaseSwitchView
interface IDatabaseSwitchView : IBaseView- Marker interface for database switch views. No members defined.
IDatabaseStatusBarView
interface IDatabaseStatusBarView : IBaseView- Marker interface for database status bar views. No members defined.
IDatabaseSwitchViewModel
interface IDatabaseSwitchViewModel : IBaseViewModel- ViewModel for transferring remote database to local database.IDatabaseSwitchView View { get; set; }- Associated view instance.void Unset()- Frees memory associated with the ViewModel.bool RemoteIsActive { get; }- Indicates if remote database is currently active.string DefaultDbName { get; }- Default database name.void InitializeDbSettings(string defaultDbName, string dbHost, bool ntlmAuthentication, string dbUser, string dbPassword)- Initializes database connection settings.void SwitchRemote()- Switches to remote database.void SwitchLocal()- Switches to local database.string DbHost { get; }- Database host address.bool NTLMAuthentication { get; }- Whether NTLM authentication is used.string DbUser { get; }- Database username.string DbPassword { get; }- Database password.
IUserDbRecord
interface IUserDbRecord- Represents a user record in the database.int ID { get; set; }- Database ID of the user.string UserName { get; set; }- Unique username.string DisplayName { get; set; }- Display string for UI.string Password { get; set; }- Hashed and salted password value (not stored in database).short Role { get; set; }- User role identifier.DateTime LastModified { get; set; }- Last modification timestamp.string LastModifiedBy { get; set; }- Username of last modifier.bool LocalOnly { get; set; }- Deprecated field for local/remote synchronization flag.
IDatabaseCopyViewModel
interface IDatabaseCopyViewModel : IBaseViewModel- ViewModel for copying remote database to local database.IDatabaseCopyView View { get; set; }- Associated view instance.void Unset()- Frees memory associated with the ViewModel.void CopyDatabase()- Copies from remote to local database usingDTS.Common.Storageto determine locations.void InitializeState(DbType dbType, string dbName)- Initializes ViewModel state.string DbName { get; }- Database name.IStatusAndProgressBarView OverallProgressBarView { get; }- Overall progress/status view.IStatusAndProgressBarView CurrentTaskProgressBarView { get; }- Current task progress/status view.DbType DatabaseType { get; }- Type of database being copied.bool CopyEnabled { get; }- Whether copy operation is enabled.bool IsCopyVisible { get; set; }- Visibility state for copy operation.
IDatabaseStatusBarViewModel
interface IDatabaseStatusBarViewModel : IBaseViewModel- ViewModel for database status bar UI.IDatabaseStatusBarView View { get; set; }- Associated view instance.void Unset()- Frees memory associated with the ViewModel.DbType DatabaseType { get; }- Current database type (requiresInitializeValuescall first).bool RemoteConnected { get; }- Remote database connection status (requiresInitializeValuescall first).string ServerName { get; }- Server name, not database name (requiresInitializeValuescall first).void InitializeValues(DbType dbType, string serverName, bool remoteConnected)- Sets initial values for display.string ActiveDbName { get; }- Current active database name based on type and connection status.Brush BackgroundBrush { get; }- Background brush for active database name display.
Invariants
IUserDbRecord.UserNamemust be unique across all users.IUserDbRecord.Passwordmust be a hashed and salted value; plain text passwords are never stored.IDatabaseSwitchViewModelrequires a local database with correct tables and stored procedures already configured before switching/copying operations.IDatabaseStatusBarViewModelproperties (DatabaseType,RemoteConnected,ServerName) requireInitializeValuesto be called before their values are meaningful.
Dependencies
- Depends on:
DTS.Common.Base(IBaseView, IBaseViewModel),DTS.Common.Enums.Database(DbType),System.Windows.Media(Brush),System(DateTime). - Depended on by: Concrete implementations of these interfaces (not shown in source).
Gotchas
IUserDbRecord.LocalOnlyis marked as deprecated in the XML documentation; its use should be avoided.- The XML documentation for
IDatabaseSwitchViewModelandIDatabaseCopyViewModelboth mention "transferring a remote database to a local database" and "clears the local database" - this is a destructive operation that overwrites local data. IDatabaseCopyViewModel.CopyDatabase()relies onDTS.Common.Storageto determine local and remote database locations, but this dependency is not visible in the interface signature.