mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
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:
@@ -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
@@ -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
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user