Show / Hide Table of Contents

Class SqliteDatabaseManager

Provides methods for database administration.

Inheritance
System.Object
SqliteDatabaseManager
Implements
IDatabaseManager
Namespace: MESL.SqlRace.Domain
Assembly: MESL.SqlRace.Domain.dll
Syntax
public class SqliteDatabaseManager : Object, IDatabaseManager
Remarks

The following database administration functions are available:

  • Adding and deleting licence information
  • Backing up and restoring a database
  • Defragmenting indexes

Constructors

SqliteDatabaseManager()

Declaration
public SqliteDatabaseManager()

Methods

BackupDatabase(String, String, String, DateTime)

Backs up the database.

Declaration
public string BackupDatabase(string masterConnectionString, string databaseName, string backupLocation, DateTime backupDate)
Parameters
Type Name Description
System.String masterConnectionString

The master catalog connection string.

System.String databaseName

Name of the database to be backed up.

System.String backupLocation

The backup location.

System.DateTime backupDate

The backup date.

Returns
Type Description
System.String

Path to the database backup

DefragmentDatabaseIndexes(String, ref Int32, ref Int32, ref Int32)

Defragments indexes on the target database.

Declaration
public void DefragmentDatabaseIndexes(string connectionString, ref int rebuilt, ref int reorganised, ref int updated)
Parameters
Type Name Description
System.String connectionString

The connection string.

System.Int32 rebuilt

Count of rebuilt indexes.

System.Int32 reorganised

Count of reorganised indexes

System.Int32 updated

Count of updated statistics.

Remarks

The following rules are used:

  • Rebuild threshold of 10%
  • Reorganise threshold of 10%
  • Statistics update threshold of 7 days

IsDatabaseReadonly(String)

Declaration
public bool IsDatabaseReadonly(string connectionString)
Parameters
Type Name Description
System.String connectionString
Returns
Type Description
System.Boolean

RestoreDatabase(String, String, String)

Restores the database.

Declaration
public void RestoreDatabase(string masterConnectionString, string databaseName, string backupPath)
Parameters
Type Name Description
System.String masterConnectionString

The master connection string.

System.String databaseName

Name of the database.

System.String backupPath

The backup path.

Implements

IDatabaseManager
Back to top Generated by DocFX