Improve database properties view: (#501)

- Compatibility Level should be a numerical value. In using `enum.ToString()` the result was `Version140` instead of `140`
- Backup date should be sensible if never backed up. Added a simple check that states it was never backed up if the backup date is before 1900.
This commit is contained in:
Kevin Cunnane
2017-10-18 09:51:00 -07:00
committed by GitHub
parent e52d95cebf
commit 4bf9b9ddae
15 changed files with 9400 additions and 19281 deletions

View File

@@ -18,6 +18,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
{
public class DatabaseTaskHelper: IDisposable
{
private static DateTime minBackupDate = new DateTime(1900, 1, 1);
private DatabasePrototype prototype;
private XmlDocument document;
@@ -109,9 +111,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.RecoveryModel, prototype.RecoveryModel.ToString());
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.IsSystemDB, prototype.IsSystemDB.ToString());
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.AnsiNulls, prototype.AnsiNulls.ToString());
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.CompatibilityLevel, prototype.DatabaseCompatibilityLevel.ToString());
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.LastBackupDate, prototype.LastBackupDate.ToString());
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.LastLogBackupDate, prototype.LastLogBackupDate.ToString());
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.CompatibilityLevel, (int)prototype.DatabaseCompatibilityLevel);
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.LastBackupDate, GetBackupDate(prototype.LastBackupDate));
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.LastLogBackupDate, GetBackupDate(prototype.LastLogBackupDate));
databaseInfo.Options.Add(
AdminServicesProviderOptionsHelper.FileGroups + "Count",
@@ -151,6 +153,16 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
return databaseInfo;
}
private static string GetBackupDate(DateTime backupDate)
{
if (backupDate == null
|| backupDate < minBackupDate)
{
return SR.NeverBackedUp;
}
return backupDate.ToString();
}
private static T GetValueOrDefault<T>(string key, Dictionary<string, object> map, T defaultValue)
{
if (map != null && map.ContainsKey(key))

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -802,6 +802,7 @@ general_containmentType_None = None
general_containmentType_Partial = Partial
filegroups_filestreamFiles = FILESTREAM Files
prototype_file_noApplicableFileGroup = No Applicable Filegroup
NeverBackedUp = Never
############################################################################
# Backup Service

File diff suppressed because it is too large Load Diff