Ejemplo n.º 1
0
        /// <summary>
        /// Given the dbName, returns its state.
        /// </summary>
        /// <param name="dbName"></param>
        /// <returns></returns>
        public static DataBaseState GetDataBaseState(string dbName)
        {
            var dbs = MasterDataBaseExecutor.Query <OnlineDatabaseBackup>(
                "SELECT name, state FROM sys.databases WHERE name = @dbName",
                new { dbName });

            return(GetDataBaseStateFromCode(dbs.FirstOrDefault().State));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns the list of all database backups present in the server.
 /// </summary>
 /// <returns></returns>
 public static List <OnlineDatabaseBackup> GetAllDatabaseBackups()
 {
     return(MasterDataBaseExecutor.Query <OnlineDatabaseBackup>(
                "SELECT name FROM sys.databases WHERE name LIKE 'Backup_%' AND state = @state",
                new { state = Util.OnlineState }).ToList());
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Returns the count of total backup databases present in the current server.
 /// </summary>
 /// <returns></returns>
 public static int GetTotalBackupDataBaseCount()
 {
     return(MasterDataBaseExecutor.Query <OnlineDatabaseBackup>(
                "SELECT name FROM sys.databases WHERE name LIKE 'Backup_%' AND state = @state",
                new { state = Util.OnlineState }).ToArray().Length);
 }