C# Класс Business.DatabaseHandler

Ensures server and database are up and running.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CopyFileAsync ( string sourcePath, string destinationPath ) : Task
DatabaseHandler ( Window owner ) : System
EnsureAvailableAsync ( ) : Task

Checks server and database availability. If there is no database file, copy and attach initial database. Update database if it is outdated.

If connection fails, the exception must be handled by the caller.

LogException ( Exception ex ) : void

Writes exception details into a log file.

UpdateDatabaseAsync ( ) : Task

Updates database if needed.

Приватные методы

Метод Описание
CreateNewDatabaseAsync ( ) : Task

Creates a new database.

GetUpdateScript ( string name ) : string

Returns the update script with specified name.

RunScript ( string scriptFile ) : void

Runs the specified database script.

TryUntilTimeout ( System.Action action, int timeout ) : Task
UpdateDatabaseToVersion ( bool backupBeforeUpdate, int major, int minor, int build, int revision ) : void

Updates database by running a script, after making an optional backup.

Описание методов

CopyFileAsync() публичный Метод

public CopyFileAsync ( string sourcePath, string destinationPath ) : Task
sourcePath string
destinationPath string
Результат Task

DatabaseHandler() публичный Метод

public DatabaseHandler ( Window owner ) : System
owner Window
Результат System

EnsureAvailableAsync() публичный Метод

Checks server and database availability. If there is no database file, copy and attach initial database. Update database if it is outdated.
If connection fails, the exception must be handled by the caller.
public EnsureAvailableAsync ( ) : Task
Результат Task

LogException() публичный Метод

Writes exception details into a log file.
public LogException ( Exception ex ) : void
ex System.Exception The exception to log.
Результат void

UpdateDatabaseAsync() публичный Метод

Updates database if needed.
public UpdateDatabaseAsync ( ) : Task
Результат Task