diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerData.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerData.cs
new file mode 100644
index 00000000..b491ab13
--- /dev/null
+++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerData.cs
@@ -0,0 +1,1357 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+using System;
+using Microsoft.SqlServer.Management.Smo;
+using SMO = Microsoft.SqlServer.Management.Smo;
+using Microsoft.SqlTools.ServiceLayer.ServerConfigurations;
+using Microsoft.SqlTools.Utility;
+using System.Collections.Generic;
+using Microsoft.SqlTools.ServiceLayer.ObjectManagement.ObjectTypes.Server;
+using Microsoft.SqlTools.ServiceLayer.Utility;
+
+namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
+{
+ ///
+ /// Represents a collection of server properties for a SQL Server instance.
+ ///
+ ///
+ /// Isolating this data allows for an easy implementation of Reset() and
+ /// simplifies difference detection when committing changes to the server.
+ ///
+ internal class ServerData : ICloneable
+ {
+ #region data members
+ private string serverName = string.Empty;
+ private string hardwareGeneration = string.Empty;
+ private string language = string.Empty;
+ private int memoryInMB = 0;
+ private string operatingSystem = string.Empty;
+ private string platform = string.Empty;
+ private int processors = 0;
+ private bool isClustered = false;
+ private bool isHadrEnabled = false;
+ private bool isPolyBaseInstalled = false;
+ private bool? isXTPSupported;
+ private string product = String.Empty;
+ private string rootDirectory = String.Empty;
+ private string serverCollation = String.Empty;
+ private string version = String.Empty;
+ private string serviceTier = String.Empty;
+ private int reservedStorageSizeMB = 0;
+ private int storageSpaceUsageInMB = 0;
+ private NumericServerProperty minMemory;
+ private NumericServerProperty maxMemory;
+ private bool autoProcessorAffinityMaskForAll = false;
+ private bool autoProcessorAffinityIOMaskForAll = false;
+ private List numaNodes = new List();
+ private ServerLoginMode authenticationMode = ServerLoginMode.Integrated;
+ private AuditLevel loginAuditing = AuditLevel.None;
+ private bool checkCompressBackup = false;
+ private bool checkBackupChecksum = false;
+ private string dataLocation = String.Empty;
+ private string logLocation = String.Empty;
+ private string backupLocation = String.Empty;
+ private bool allowTriggerToFireOthers = false;
+ private NumericServerProperty blockedProcThreshold;
+ private NumericServerProperty cursorThreshold;
+ private string defaultFullTextLanguage = String.Empty;
+ private string defaultLanguage = String.Empty;
+ private string fullTextUpgradeOption = String.Empty;
+ private NumericServerProperty maxTextReplicationSize;
+ private bool optimizeAdHocWorkloads = false;
+ private bool scanStartupProcs = false;
+ private int twoDigitYearCutoff = 0;
+ private NumericServerProperty costThresholdParallelism;
+ private NumericServerProperty locks;
+ private NumericServerProperty maxDegreeParallelism;
+ private NumericServerProperty queryWait;
+ private bool initialized = false;
+ private Server server;
+ private ServerConfigService configService;
+ private AffinityManager affinityManagerIOMask;
+ private AffinityManager affinityManagerProcessorMask;
+
+ private bool isYukonOrLater = false;
+ private bool isSqlServer64Bit;
+ private bool isIOAffinitySupported = false;
+ #endregion
+
+ #region Properties
+
+ // General properties
+
+ public string ServerName
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.serverName;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("ServerName"));
+ }
+ this.serverName = value;
+ }
+ }
+
+ public string HardwareGeneration
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.hardwareGeneration;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("HardwareGeneration"));
+ }
+ this.hardwareGeneration = value;
+ }
+ }
+
+ public string Language
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.language;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("Language"));
+ }
+ this.language = value;
+ }
+ }
+
+ public int MemoryInMB
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.memoryInMB;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("MemoryInMB"));
+ }
+ this.memoryInMB = value;
+ }
+ }
+
+ public string OperatingSystem
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.operatingSystem;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("OperatingSystem"));
+ }
+ this.operatingSystem = value;
+ }
+ }
+
+ public string Platform
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.platform;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("Platform"));
+ }
+ this.platform = value;
+ }
+ }
+
+ public int Processors
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.processors;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("Processors"));
+ }
+ this.processors = value;
+ }
+ }
+
+ public bool IsClustered
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.isClustered;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("IsClustered"));
+ }
+ this.isClustered = value;
+ }
+ }
+
+ public bool IsHadrEnabled
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.isHadrEnabled;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("IsHadrEnabled"));
+ }
+ this.isHadrEnabled = value;
+ }
+ }
+
+ public bool IsPolyBaseInstalled
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.isPolyBaseInstalled;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("IsPolyBaseInstalled"));
+ }
+ this.isPolyBaseInstalled = value;
+ }
+ }
+
+ public bool? IsXTPSupported
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.isXTPSupported;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("IsXTPSupported"));
+ }
+ this.isXTPSupported = value;
+ }
+ }
+
+
+ public string Product
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.product;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("Product"));
+ }
+ this.product = value;
+ }
+ }
+
+ public string RootDirectory
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.rootDirectory;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("RootDirectory"));
+ }
+ this.rootDirectory = value;
+ }
+ }
+
+ public string ServerCollation
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.serverCollation;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("ServerCollation"));
+ }
+ this.serverCollation = value;
+ }
+ }
+
+ public string Version
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.version;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("Version"));
+ }
+ this.version = value;
+ }
+ }
+
+ public string ServiceTier
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.serviceTier;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("ServiceTier"));
+ }
+ this.serviceTier = value;
+ }
+ }
+
+ public int StorageSpaceUsageInMB
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.storageSpaceUsageInMB;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("StorageSpaceUsageInMB"));
+ }
+ this.storageSpaceUsageInMB = value;
+ }
+ }
+
+
+ public int ReservedStorageSizeMB
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.reservedStorageSizeMB;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("ReservedStorageSizeMB"));
+ }
+ this.reservedStorageSizeMB = value;
+ }
+ }
+
+
+ public NumericServerProperty MinMemory
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.minMemory;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("MinMemory"));
+ }
+
+ this.minMemory = value;
+ }
+ }
+
+ public NumericServerProperty MaxMemory
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.maxMemory;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("MaxMemory"));
+ }
+
+ this.maxMemory = value;
+ }
+ }
+
+ public bool AutoProcessorAffinityMaskForAll
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.autoProcessorAffinityMaskForAll;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("AutoProcessorAffinityMaskForAll"));
+ }
+
+ this.autoProcessorAffinityMaskForAll = value;
+ }
+ }
+
+ public bool AutoProcessorAffinityIOMaskForAll
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.autoProcessorAffinityIOMaskForAll;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("AutoProcessorAffinityIOMaskForAll"));
+ }
+
+ this.autoProcessorAffinityIOMaskForAll = value;
+ }
+ }
+
+ public List NumaNodes
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.numaNodes;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("NumaNodes"));
+ }
+
+ this.numaNodes = value;
+ }
+ }
+
+ public ServerLoginMode AuthenticationMode
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.authenticationMode;
+ }
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("AuthenticationMode"));
+ }
+
+ this.authenticationMode = value;
+ }
+ }
+
+ public AuditLevel LoginAuditing
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.loginAuditing;
+ }
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("LoginAuditing"));
+ }
+
+ this.loginAuditing = value;
+ }
+ }
+
+ public AffinityManager AffinityManagerIOMask
+ {
+ get
+ {
+ return this.affinityManagerIOMask;
+ }
+
+ set
+ {
+ this.affinityManagerIOMask = value;
+ }
+ }
+
+ public AffinityManager AffinityManagerProcessorMask
+ {
+ get
+ {
+ return this.affinityManagerProcessorMask;
+ }
+
+ set
+ {
+ this.affinityManagerProcessorMask = value;
+ }
+ }
+
+ public bool CheckBackupChecksum
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.checkBackupChecksum;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("CheckBackupChecksum"));
+ }
+ this.checkBackupChecksum = value;
+ }
+ }
+
+ public bool CheckCompressBackup
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.checkCompressBackup;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("CheckCompressBackup"));
+ }
+ this.checkCompressBackup = value;
+ }
+ }
+
+ public string DataLocation
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.dataLocation;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("DataLocation"));
+ }
+ this.dataLocation = value;
+ }
+ }
+
+ public string LogLocation
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.logLocation;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("LogLocation"));
+ }
+ this.logLocation = value;
+ }
+ }
+
+ public string BackupLocation
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.backupLocation;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("BackupLocation"));
+ }
+ this.backupLocation = value;
+ }
+ }
+
+ public bool AllowTriggerToFireOthers
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.allowTriggerToFireOthers;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("AllowTriggerToFireOthers"));
+ }
+ this.allowTriggerToFireOthers = value;
+ }
+ }
+
+ public NumericServerProperty BlockedProcThreshold
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.blockedProcThreshold;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("BlockedProcThreshold"));
+ }
+
+ this.blockedProcThreshold = value;
+ }
+ }
+
+ public NumericServerProperty CursorThreshold
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.cursorThreshold;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("CursorThreshold"));
+ }
+
+ this.cursorThreshold = value;
+ }
+ }
+
+ public string DefaultFullTextLanguage
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.defaultFullTextLanguage;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("DefaultFullTextLanguage"));
+ }
+ this.defaultFullTextLanguage = value;
+ }
+ }
+
+ public string DefaultLanguage
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.defaultLanguage;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("DefaultLanguage"));
+ }
+ this.defaultLanguage = value;
+ }
+ }
+
+ public string FullTextUpgradeOption
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.fullTextUpgradeOption;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("FullTextUpgradeOption"));
+ }
+ this.fullTextUpgradeOption = value;
+ }
+ }
+
+ public NumericServerProperty MaxTextReplicationSize
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.maxTextReplicationSize;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("MaxTextReplicationSize"));
+ }
+
+ this.maxTextReplicationSize = value;
+ }
+ }
+
+ public bool OptimizeAdHocWorkloads
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.optimizeAdHocWorkloads;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("OptimizeAdHocWorkloads"));
+ }
+ this.optimizeAdHocWorkloads = value;
+ }
+ }
+
+ public bool ScanStartupProcs
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.scanStartupProcs;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("ScanStartupProcs"));
+ }
+ this.scanStartupProcs = value;
+ }
+ }
+
+ public int TwoDigitYearCutoff
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.twoDigitYearCutoff;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("TwoDigitYearCutoff"));
+ }
+ this.twoDigitYearCutoff = value;
+ }
+ }
+
+ public NumericServerProperty CostThresholdParallelism
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.costThresholdParallelism;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("CostThresholdParallelism"));
+ }
+ this.costThresholdParallelism = value;
+ }
+ }
+
+ public NumericServerProperty Locks
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.locks;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("Locks"));
+ }
+ this.locks = value;
+ }
+ }
+
+ public NumericServerProperty MaxDegreeParallelism
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.maxDegreeParallelism;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("MaxDegreeParallelism"));
+ }
+ this.maxDegreeParallelism = value;
+ }
+ }
+
+ public NumericServerProperty QueryWait
+ {
+ get
+ {
+ if (!this.initialized)
+ {
+ LoadData();
+ }
+
+ return this.queryWait;
+ }
+
+ set
+ {
+ if (this.initialized)
+ {
+ Logger.Error(SR.PropertyNotInitialized("QueryWait"));
+ }
+ this.queryWait = value;
+ }
+ }
+
+ #endregion
+
+ ///
+ /// private default constructor - used by Clone()
+ ///
+ private ServerData()
+ {
+ }
+
+
+ ///
+ /// constructor
+ ///
+ /// The context in which we are modifying an existing server
+ /// The server we are modifying
+ public ServerData(Server server, ServerConfigService service)
+ {
+ this.server = server;
+ this.configService = service;
+ this.isYukonOrLater = (this.server.Information.Version.Major >= 9);
+ this.isSqlServer64Bit = (this.server.Edition.Contains("(64 - bit)"));
+ this.affinityManagerIOMask = new AffinityManager();
+ this.affinityManagerProcessorMask = new AffinityManager();
+ this.minMemory = new NumericServerProperty();
+ this.maxMemory = new NumericServerProperty();
+ this.blockedProcThreshold = new NumericServerProperty();
+ this.cursorThreshold = new NumericServerProperty();
+ this.maxTextReplicationSize = new NumericServerProperty();
+ this.costThresholdParallelism = new NumericServerProperty();
+ this.locks = new NumericServerProperty();
+ this.maxDegreeParallelism = new NumericServerProperty();
+ this.queryWait = new NumericServerProperty();
+ this.NumaNodes = new List();
+ LoadData();
+ }
+
+ ///
+ /// Create a clone of this ServerRolePrototypeData object
+ ///
+ /// The clone ServerRolePrototypeData object
+ public object Clone()
+ {
+ ServerData result = new ServerData();
+ result.serverName = this.serverName;
+ result.initialized = this.initialized;
+ result.hardwareGeneration = this.hardwareGeneration;
+ result.language = this.language;
+ result.memoryInMB = this.memoryInMB;
+ result.operatingSystem = this.operatingSystem;
+ result.platform = this.platform;
+ result.processors = this.processors;
+ result.isClustered = this.isClustered;
+ result.isHadrEnabled = this.isHadrEnabled;
+ result.isPolyBaseInstalled = this.isPolyBaseInstalled;
+ result.isXTPSupported = this.isXTPSupported;
+ result.product = this.product;
+ result.reservedStorageSizeMB = this.reservedStorageSizeMB;
+ result.rootDirectory = this.rootDirectory;
+ result.serverCollation = this.serverCollation;
+ result.serviceTier = this.serviceTier;
+ result.storageSpaceUsageInMB = this.storageSpaceUsageInMB;
+ result.version = this.version;
+ result.maxMemory = this.maxMemory;
+ result.minMemory = this.minMemory;
+ result.autoProcessorAffinityMaskForAll = this.autoProcessorAffinityMaskForAll;
+ result.autoProcessorAffinityIOMaskForAll = this.autoProcessorAffinityIOMaskForAll;
+ result.numaNodes = this.numaNodes;
+ result.authenticationMode = this.authenticationMode;
+ result.loginAuditing = this.loginAuditing;
+ result.checkBackupChecksum = this.checkBackupChecksum;
+ result.checkCompressBackup = this.checkCompressBackup;
+ result.dataLocation = this.dataLocation;
+ result.logLocation = this.logLocation;
+ result.backupLocation = this.backupLocation;
+ result.allowTriggerToFireOthers = this.allowTriggerToFireOthers;
+ result.blockedProcThreshold = this.blockedProcThreshold;
+ result.cursorThreshold = this.cursorThreshold;
+ result.defaultFullTextLanguage = this.defaultFullTextLanguage;
+ result.defaultLanguage = this.defaultLanguage;
+ result.fullTextUpgradeOption = this.fullTextUpgradeOption;
+ result.maxTextReplicationSize = this.maxTextReplicationSize;
+ result.optimizeAdHocWorkloads = this.optimizeAdHocWorkloads;
+ result.scanStartupProcs = this.scanStartupProcs;
+ result.twoDigitYearCutoff = this.twoDigitYearCutoff;
+ result.costThresholdParallelism = this.costThresholdParallelism;
+ result.locks = this.locks;
+ result.maxDegreeParallelism = this.maxDegreeParallelism;
+ result.queryWait = this.queryWait;
+ result.server = this.server;
+ return result;
+ }
+
+ private void LoadData()
+ {
+ this.initialized = true;
+ LoadGeneralProperties();
+ LoadMemoryProperties();
+ LoadProcessorsProperties();
+ LoadSecurityProperties();
+ LoadDBSettingsProperties();
+ LoadAdvancedProperties();
+ }
+
+ private void LoadGeneralProperties()
+ {
+ this.serverName = server.Name;
+ this.language = server.Language;
+ this.memoryInMB = server.PhysicalMemory;
+ this.processors = server.Processors;
+ this.isClustered = server.IsClustered;
+ this.isHadrEnabled = server.IsHadrEnabled;
+ this.isPolyBaseInstalled = server.IsPolyBaseInstalled;
+
+ this.product = server.Product;
+ this.rootDirectory = server.RootDirectory;
+ this.serverCollation = server.Collation;
+ this.version = server.VersionString;
+ if (server.EngineEdition == Edition.SqlManagedInstance)
+ {
+ this.hardwareGeneration = server.HardwareGeneration;
+ this.serviceTier = server.ServiceTier;
+ this.reservedStorageSizeMB = server.ReservedStorageSizeMB;
+ this.storageSpaceUsageInMB = server.UsedStorageSizeMB;
+ }
+ else
+ {
+ this.isXTPSupported = server.IsXTPSupported;
+ }
+ if (server.VersionMajor >= 14)
+ {
+ this.operatingSystem = server.HostDistribution;
+ this.platform = server.HostPlatform;
+ }
+ if (server.VersionMajor >= 13)
+ {
+ this.isPolyBaseInstalled = server.IsPolyBaseInstalled;
+ }
+ }
+
+ private void LoadMemoryProperties()
+ {
+ this.maxMemory.Value = server.Configuration.MaxServerMemory.ConfigValue;
+ this.maxMemory.MaximumValue = server.Configuration.MaxServerMemory.Maximum;
+ this.maxMemory.MinimumValue = server.Configuration.MaxServerMemory.Minimum;
+
+ this.minMemory.Value = server.Configuration.MinServerMemory.ConfigValue;
+ this.minMemory.MaximumValue = server.Configuration.MinServerMemory.Maximum;
+ this.minMemory.MinimumValue = server.Configuration.MinServerMemory.Minimum;
+ }
+
+ private void LoadProcessorsProperties()
+ {
+ try
+ {
+ this.affinityManagerIOMask.InitializeAffinity(this.server.Configuration.AffinityIOMask, this.server.Configuration.Affinity64IOMask);
+ this.isIOAffinitySupported = true;
+ }
+ catch
+ {
+ this.isIOAffinitySupported = false;
+ }
+ this.affinityManagerProcessorMask.InitializeAffinity(this.server.Configuration.AffinityMask, this.server.Configuration.Affinity64Mask);
+
+ this.numaNodes = GetNumaNodes();
+ GetAutoProcessorsAffinity();
+ }
+
+ private void LoadSecurityProperties()
+ {
+ this.authenticationMode = server.LoginMode;
+ this.loginAuditing = server.AuditLevel;
+ }
+
+ private void LoadDBSettingsProperties()
+ {
+ this.checkBackupChecksum = server.Configuration.DefaultBackupChecksum.ConfigValue == 1;
+ this.checkCompressBackup = server.Configuration.DefaultBackupCompression.ConfigValue == 1;
+ this.dataLocation = server.Settings.DefaultFile;
+ this.logLocation = server.Settings.DefaultLog;
+ this.backupLocation = server.Settings.BackupDirectory;
+ }
+
+ private void LoadAdvancedProperties()
+ {
+ this.allowTriggerToFireOthers = server.Configuration.NestedTriggers.ConfigValue == 1;
+ this.blockedProcThreshold.Value = server.Configuration.BlockedProcessThreshold.ConfigValue;
+ this.blockedProcThreshold.MinimumValue = server.Configuration.BlockedProcessThreshold.Minimum;
+ this.blockedProcThreshold.MaximumValue = server.Configuration.BlockedProcessThreshold.Maximum;
+ this.cursorThreshold.Value = server.Configuration.CursorThreshold.ConfigValue;
+ this.cursorThreshold.MinimumValue = server.Configuration.CursorThreshold.Minimum;
+ this.cursorThreshold.MaximumValue = server.Configuration.CursorThreshold.Maximum;
+ this.defaultFullTextLanguage = LanguageUtils.GetLanguageChoiceAlias(server, server.Configuration.DefaultFullTextLanguage.ConfigValue).alias;
+ var defaultLanguageLcid = LanguageUtils.GetLcidFromLangId(server, server.Configuration.DefaultLanguage.ConfigValue);
+ this.defaultLanguage = (LanguageUtils.GetLanguageChoiceAlias(server, defaultLanguageLcid)).ToString();
+ this.maxTextReplicationSize.Value = server.Configuration.ReplicationMaxTextSize.ConfigValue;
+ this.maxTextReplicationSize.MinimumValue = server.Configuration.ReplicationMaxTextSize.Minimum;
+ this.maxTextReplicationSize.MaximumValue = server.Configuration.ReplicationMaxTextSize.Maximum;
+ this.optimizeAdHocWorkloads = server.Configuration.OptimizeAdhocWorkloads.ConfigValue == 1;
+ this.scanStartupProcs = server.Configuration.ScanForStartupProcedures.ConfigValue == 1;
+ this.twoDigitYearCutoff = server.Configuration.TwoDigitYearCutoff.ConfigValue;
+ this.costThresholdParallelism.Value = server.Configuration.CostThresholdForParallelism.ConfigValue;
+ this.costThresholdParallelism.MinimumValue = server.Configuration.CostThresholdForParallelism.Minimum;
+ this.costThresholdParallelism.MaximumValue = server.Configuration.CostThresholdForParallelism.Maximum;
+ this.locks.Value = server.Configuration.Locks.ConfigValue;
+ this.locks.MinimumValue = server.Configuration.Locks.Minimum;
+ this.locks.MaximumValue = server.Configuration.Locks.Maximum;
+ this.maxDegreeParallelism.Value = server.Configuration.MaxDegreeOfParallelism.ConfigValue;
+ this.maxDegreeParallelism.MinimumValue = server.Configuration.MaxDegreeOfParallelism.Minimum;
+ this.maxDegreeParallelism.MaximumValue = server.Configuration.MaxDegreeOfParallelism.Maximum;
+ this.queryWait.Value = server.Configuration.QueryWait.ConfigValue;
+ this.queryWait.MinimumValue = server.Configuration.QueryWait.Minimum;
+ this.queryWait.MaximumValue = server.Configuration.QueryWait.Maximum;
+ try
+ {
+ this.fullTextUpgradeOption = server.FullTextService.CatalogUpgradeOption.ToString();
+ }
+ catch
+ {
+ this.fullTextUpgradeOption = String.Empty;
+ }
+ }
+
+ ///
+ /// Get affinity masks for first 32 and next 32 processors (total 64 processors) if the
+ /// processor masks have been modified after being read from the server.
+ ///
+ /// returns the affinity for first 32 processors. null if not changed
+ /// return the affinity for CPUs 33-64. null if not changed.
+ private List GetNumaNodes()
+ {
+ List results = new List();
+ foreach (SMO.NumaNode node in this.server.AffinityInfo.NumaNodes)
+ {
+ var processors = new List();
+ foreach (SMO.Cpu cpu in node.Cpus)
+ {
+ if (cpu.GroupID == 0)
+ {
+ var affinityIO = this.AffinityManagerIOMask.GetAffinity(cpu.ID, true);
+ if (!cpu.AffinityMask && this.isIOAffinitySupported && affinityIO) // if it's false then check if io affinity is checked
+ {
+ this.AffinityManagerIOMask.initialIOAffinityArray[cpu.ID] = true;
+ }
+
+ // get affinityIO info if group id is 0
+ processors.Add(new ProcessorAffinity() { ProcessorId = cpu.ID.ToString(), Affinity = cpu.AffinityMask, IOAffinity = affinityIO });
+ }
+ }
+ var result = new NumaNode() { NumaNodeId = node.ID.ToString(), Processors = processors };
+ results.Add(result);
+ }
+ return results;
+ }
+
+ private void GetAutoProcessorsAffinity()
+ {
+ if (this.server.AffinityInfo.AffinityType == Microsoft.SqlServer.Management.Smo.AffinityType.Auto)
+ {
+ this.autoProcessorAffinityMaskForAll = this.autoProcessorAffinityIOMaskForAll = true;
+ }
+ else
+ {
+ this.autoProcessorAffinityMaskForAll = this.autoProcessorAffinityIOMaskForAll = false;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerHandler.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerHandler.cs
index 551d15cc..b3b1522c 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerHandler.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerHandler.cs
@@ -6,6 +6,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
+using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.Management;
@@ -38,29 +39,22 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
ConnectionInfo connInfo = this.GetConnectionInfo(requestParams.ConnectionUri);
CDataContainer dataContainer = CDataContainer.CreateDataContainer(connInfo, databaseExists: true);
- ServerPrototype prototype = new ServerPrototype(dataContainer);
+ ServerPrototype prototype = CreateServerPrototype(dataContainer.Server, dataContainer.ServerConnection);
if (prototype != null)
{
- this.serverViewInfo.ObjectInfo = new ServerInfo()
+ var serverObjInfo = new ServerInfo()
{
Name = prototype.Name,
- HardwareGeneration = prototype.HardwareGeneration,
Language = prototype.Language,
MemoryInMB = prototype.MemoryInMB,
- OperatingSystem = prototype.OperatingSystem,
- Platform = prototype.Platform,
Processors = prototype.Processors,
IsClustered = prototype.IsClustered,
IsHadrEnabled = prototype.IsHadrEnabled,
- IsPolyBaseInstalled = prototype.IsPolyBaseInstalled,
IsXTPSupported = prototype.IsXTPSupported,
Product = prototype.Product,
- ReservedStorageSizeMB = prototype.ReservedStorageSizeMB,
RootDirectory = prototype.RootDirectory,
ServerCollation = prototype.ServerCollation,
- ServiceTier = prototype.ServiceTier,
- StorageSpaceUsageInMB = prototype.StorageSpaceUsageInMB,
Version = prototype.Version,
MinServerMemory = prototype.MinServerMemory,
MaxServerMemory = prototype.MaxServerMemory,
@@ -89,6 +83,24 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
MaxDegreeParallelism = prototype.MaxDegreeParallelism,
QueryWait = prototype.QueryWait
};
+ if (prototype is ServerPrototypeMI sMI)
+ {
+ serverObjInfo.HardwareGeneration = sMI.HardwareGeneration;
+ serverObjInfo.ServiceTier = sMI.ServiceTier;
+ serverObjInfo.ReservedStorageSizeMB = sMI.ReservedStorageSizeMB;
+ serverObjInfo.StorageSpaceUsageInMB = sMI.StorageSpaceUsageInMB;
+ }
+ if (prototype is ServerPrototype140 s140)
+ {
+ serverObjInfo.OperatingSystem = s140.OperatingSystem;
+ serverObjInfo.Platform = s140.Platform;
+ }
+ if (prototype is ServerPrototype130 s130)
+ {
+ serverObjInfo.IsPolyBaseInstalled = s130.IsPolyBaseInstalled;
+ }
+
+ serverViewInfo.ObjectInfo = serverObjInfo;
serverViewInfo.LanguageOptions = (LanguageUtils.GetDefaultLanguageOptions(dataContainer)).Select(element => element.Language.Alias).ToArray();
serverViewInfo.FullTextUpgradeOptions = Enum.GetNames(typeof(FullTextCatalogUpgradeOption)).ToArray();
}
@@ -119,7 +131,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
{
try
{
- ServerPrototype prototype = new ServerPrototype(dataContainer);
+ ServerPrototype prototype = CreateServerPrototype(dataContainer.Server, dataContainer.ServerConnection);
prototype.ApplyInfoToPrototype(serverInfo);
return ConfigureServer(dataContainer, ConfigAction.Update, runType, prototype);
}
@@ -149,5 +161,27 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
return sqlScript;
}
}
+
+ private ServerPrototype CreateServerPrototype(Server server, ServerConnection connection)
+ {
+ ServerPrototype prototype;
+ if (server.EngineEdition == Edition.SqlManagedInstance)
+ {
+ prototype = new ServerPrototypeMI(server, connection);
+ }
+ else if (server.VersionMajor >= 14)
+ {
+ prototype = new ServerPrototype140(server, connection);
+ }
+ else if (server.VersionMajor == 13)
+ {
+ prototype = new ServerPrototype130(server, connection);
+ }
+ else
+ {
+ prototype = new ServerPrototype(server, connection);
+ }
+ return prototype;
+ }
}
}
\ No newline at end of file
diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerInfo.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerInfo.cs
index 130fe3a5..98eb6b47 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerInfo.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerInfo.cs
@@ -14,7 +14,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
///
public class ServerInfo : SqlObject
{
- public string? HardwareGeneration { get; set; }
+ public string HardwareGeneration { get; set; }
public string Language { get; set; }
public int MemoryInMB { get; set; }
public string OperatingSystem { get; set; }
@@ -22,13 +22,13 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
public int Processors { get; set; }
public bool IsClustered { get; set; }
public bool IsHadrEnabled { get; set; }
- public bool IsPolyBaseInstalled { get; set; }
+ public bool? IsPolyBaseInstalled { get; set; }
public bool? IsXTPSupported { get; set; }
public string Product { get; set; }
public int? ReservedStorageSizeMB { get; set; }
public string RootDirectory { get; set; }
public string ServerCollation { get; set; }
- public string? ServiceTier { get; set; }
+ public string ServiceTier { get; set; }
public int? StorageSpaceUsageInMB { get; set; }
public string Version { get; set; }
public NumericServerProperty MaxServerMemory { get; set; }
diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype.cs
index 7e773fa1..4d62b3e6 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype.cs
@@ -6,10 +6,8 @@
using System;
using Microsoft.SqlServer.Management.Smo;
using SMO = Microsoft.SqlServer.Management.Smo;
-using Microsoft.SqlTools.ServiceLayer.Management;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlTools.ServiceLayer.ServerConfigurations;
-using Microsoft.SqlTools.Utility;
using System.Collections.Generic;
using Microsoft.SqlTools.ServiceLayer.ObjectManagement.ObjectTypes.Server;
using System.Linq;
@@ -22,29 +20,12 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
{
#region Members
- ///
- /// data container member that contains data specific information like
- /// connection infor, SMO server object or an AMO server object as well
- /// as a hash table where one can manipulate custom data
- ///
- private CDataContainer dataContainer;
+ private Server server;
private ServerConnection sqlConnection;
private ServerConfigService configService;
- private ServerPrototypeData currentState;
- private ServerPrototypeData originalState;
- #endregion
-
- #region Trace support
- private const string componentName = "Server";
-
- public string ComponentName
- {
- get
- {
- return componentName;
- }
- }
+ protected ServerData currentState;
+ private ServerData originalState;
#endregion
#region Properties
@@ -72,18 +53,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
}
}
- public string OperatingSystem
- {
- get
- {
- return this.currentState.OperatingSystem;
- }
- set
- {
- this.currentState.OperatingSystem = value;
- }
- }
-
public string Version
{
get
@@ -108,18 +77,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
}
}
- public string Platform
- {
- get
- {
- return this.currentState.Platform;
- }
- set
- {
- this.currentState.Platform = value;
- }
- }
-
public int MemoryInMB
{
get
@@ -192,7 +149,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
}
}
- public bool IsXTPSupported
+ public bool? IsXTPSupported
{
get
{
@@ -204,69 +161,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
}
}
- public bool IsPolyBaseInstalled
- {
- get
- {
- return this.currentState.IsPolyBaseInstalled;
- }
- set
- {
- this.currentState.IsPolyBaseInstalled = value;
- }
- }
-
-
- public string HardwareGeneration
- {
- get
- {
- return this.currentState.HardwareGeneration;
- }
- set
- {
- this.currentState.HardwareGeneration = value;
- }
- }
-
- public string ServiceTier
- {
- get
- {
- return this.currentState.ServiceTier;
- }
- set
- {
- this.currentState.ServiceTier = value;
- }
- }
-
- public int StorageSpaceUsageInMB
- {
- get
- {
- return this.currentState.StorageSpaceUsageInMB;
- }
- set
- {
- this.currentState.StorageSpaceUsageInMB = value;
- }
- }
-
-
- public int ReservedStorageSizeMB
- {
- get
- {
- return this.currentState.ReservedStorageSizeMB;
- }
- set
- {
- this.currentState.ReservedStorageSizeMB = value;
- }
- }
-
-
public NumericServerProperty MaxServerMemory
{
get
@@ -605,13 +499,13 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
///
/// ServerPrototype for editing an existing server
///
- public ServerPrototype(CDataContainer context)
+ public ServerPrototype(Server server, ServerConnection connection)
{
- this.dataContainer = context;
- this.sqlConnection = context.ServerConnection;
+ this.server = server;
+ this.sqlConnection = connection;
this.configService = new ServerConfigService();
- this.currentState = new ServerPrototypeData(context, context.Server, this.configService);
- this.originalState = (ServerPrototypeData)this.currentState.Clone();
+ this.currentState = new ServerData(server, this.configService);
+ this.originalState = (ServerData)this.currentState.Clone();
}
#endregion
@@ -624,38 +518,38 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
///
public void SendDataToServer()
{
- if (this.dataContainer.Server != null)
+ if (this.server != null)
{
- Server server = this.dataContainer.Server;
+ Server server = this.server;
- if (UpdateMemoryValues(this.dataContainer.Server))
+ if (UpdateMemoryValues(this.server))
{
server.Configuration.Alter(true);
}
- UpdateProcessorsValues(this.dataContainer.Server);
+ UpdateProcessorsValues(this.server);
- if (UpdateSecurityValues(this.dataContainer.Server))
+ if (UpdateSecurityValues(this.server))
{
server.Alter();
}
- if (UpdateDBSettingsValues(this.dataContainer.Server))
+ if (UpdateDBSettingsValues(this.server))
{
server.Settings.Alter();
}
- if (UpdateBackupConfig(this.dataContainer.Server))
+ if (UpdateBackupConfig(this.server))
{
server.Configuration.Alter();
}
- if (UpdateAdvancedValues(this.dataContainer.Server))
+ if (UpdateAdvancedValues(this.server))
{
server.Configuration.Alter();
}
- if (UpdateFullTextService(this.dataContainer.Server))
+ if (UpdateFullTextService(this.server))
{
server.FullTextService.Alter();
}
@@ -914,8 +808,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
}
return false;
}
+
///
- /// This will send data for KJ specific things
+ /// This will send data for Kilimanjaro specific things
/// Also Checks if Alter needs to be generated
///
private void SendDataForKJ(SMO.Server smoServer)
@@ -1024,26 +919,20 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
}
#endregion
- public void ApplyInfoToPrototype(ServerInfo serverInfo)
+ public virtual void ApplyInfoToPrototype(ServerInfo serverInfo)
{
- this.Name = serverInfo.Name;
+ this.Name = serverInfo.Name ?? string.Empty;
this.Language = serverInfo.Language;
this.MemoryInMB = serverInfo.MemoryInMB;
- this.OperatingSystem = serverInfo.OperatingSystem;
- this.Platform = serverInfo.Platform;
this.Version = serverInfo.Version;
this.Processors = serverInfo.Processors;
this.Version = serverInfo.Version;
this.IsClustered = serverInfo.IsClustered;
this.IsHadrEnabled = serverInfo.IsHadrEnabled;
- this.IsPolyBaseInstalled = serverInfo.IsPolyBaseInstalled;
- this.IsXTPSupported = (bool)(serverInfo.IsXTPSupported);
+ this.IsXTPSupported = serverInfo.IsXTPSupported.GetValueOrDefault();
this.Product = serverInfo.Product;
- this.ReservedStorageSizeMB = (int)(serverInfo.ReservedStorageSizeMB);
this.RootDirectory = serverInfo.RootDirectory;
this.ServerCollation = serverInfo.ServerCollation;
- this.ServiceTier = serverInfo.ServiceTier;
- this.StorageSpaceUsageInMB = (int)(serverInfo.StorageSpaceUsageInMB);
this.MaxServerMemory = serverInfo.MaxServerMemory;
this.MinServerMemory = serverInfo.MinServerMemory;
this.AutoProcessorAffinityMaskForAll = serverInfo.AutoProcessorAffinityMaskForAll;
@@ -1071,1348 +960,5 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
this.MaxDegreeParallelism = serverInfo.MaxDegreeParallelism;
this.QueryWait = serverInfo.QueryWait;
}
-
- ///
- /// Private class encapsulating the data that is changed by the UI.
- ///
- ///
- /// Isolating this data allows for an easy implementation of Reset() and
- /// simplifies difference detection when committing changes to the server.
- ///
- private class ServerPrototypeData : ICloneable
- {
- #region data members
- private string serverName = string.Empty;
- private string hardwareGeneration = String.Empty;
- private string language = String.Empty;
- private int memoryInMB = 0;
- private string operatingSystem = String.Empty;
- private string platform = String.Empty;
- private int processors = 0;
- private bool isClustered = false;
- private bool isHadrEnabled = false;
- private bool isPolyBaseInstalled = false;
- private bool isXTPSupported = false;
- private string product = String.Empty;
- private string rootDirectory = String.Empty;
- private string serverCollation = String.Empty;
- private string version = String.Empty;
- private string serviceTier = String.Empty;
- private int reservedStorageSizeMB = 0;
- private int storageSpaceUsageInMB = 0;
- private NumericServerProperty minMemory;
- private NumericServerProperty maxMemory;
- private bool autoProcessorAffinityMaskForAll = false;
- private bool autoProcessorAffinityIOMaskForAll = false;
- private List numaNodes = new List();
- private ServerLoginMode authenticationMode = ServerLoginMode.Integrated;
- private AuditLevel loginAuditing = AuditLevel.None;
- private bool checkCompressBackup = false;
- private bool checkBackupChecksum = false;
- private string dataLocation = String.Empty;
- private string logLocation = String.Empty;
- private string backupLocation = String.Empty;
- private bool allowTriggerToFireOthers = false;
- private NumericServerProperty blockedProcThreshold;
- private NumericServerProperty cursorThreshold;
- private string defaultFullTextLanguage = String.Empty;
- private string defaultLanguage = String.Empty;
- private string fullTextUpgradeOption = String.Empty;
- private NumericServerProperty maxTextReplicationSize;
- private bool optimizeAdHocWorkloads = false;
- private bool scanStartupProcs = false;
- private int twoDigitYearCutoff = 0;
- private NumericServerProperty costThresholdParallelism;
- private NumericServerProperty locks;
- private NumericServerProperty maxDegreeParallelism;
- private NumericServerProperty queryWait;
- private bool initialized = false;
- private Server server;
- private CDataContainer context;
- private ServerConfigService configService;
- private AffinityManager affinityManagerIOMask;
- private AffinityManager affinityManagerProcessorMask;
-
- private bool isYukonOrLater = false;
- private bool isSqlServer64Bit;
- private bool isIOAffinitySupported = false;
- #endregion
-
- #region Properties
-
- // General properties
-
-
- public string ServerName
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.serverName;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("ServerName"));
- }
- this.serverName = value;
- }
- }
-
- public string HardwareGeneration
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.hardwareGeneration;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("HardwareGeneration"));
- }
- this.hardwareGeneration = value;
- }
- }
-
- public string Language
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.language;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("Language"));
- }
- this.language = value;
- }
- }
-
- public int MemoryInMB
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.memoryInMB;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("MemoryInMB"));
- }
- this.memoryInMB = value;
- }
- }
-
- public string OperatingSystem
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.operatingSystem;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("OperatingSystem"));
- }
- this.operatingSystem = value;
- }
- }
-
- public string Platform
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.platform;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("Platform"));
- }
- this.platform = value;
- }
- }
-
- public int Processors
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.processors;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("Processors"));
- }
- this.processors = value;
- }
- }
-
- public bool IsClustered
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.isClustered;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("IsClustered"));
- }
- this.isClustered = value;
- }
- }
-
- public bool IsHadrEnabled
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.isHadrEnabled;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("IsHadrEnabled"));
- }
- this.isHadrEnabled = value;
- }
- }
-
- public bool IsPolyBaseInstalled
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.isPolyBaseInstalled;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("IsPolyBaseInstalled"));
- }
- this.isPolyBaseInstalled = value;
- }
- }
-
- public bool IsXTPSupported
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.isXTPSupported;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("IsXTPSupported"));
- }
- this.isXTPSupported = value;
- }
- }
-
-
- public string Product
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.product;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("Product"));
- }
- this.product = value;
- }
- }
-
- public string RootDirectory
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.rootDirectory;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("RootDirectory"));
- }
- this.rootDirectory = value;
- }
- }
-
- public string ServerCollation
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.serverCollation;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("ServerCollation"));
- }
- this.serverCollation = value;
- }
- }
-
- public string Version
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.version;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("Version"));
- }
- this.version = value;
- }
- }
-
- public string ServiceTier
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.serviceTier;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("ServiceTier"));
- }
- this.serviceTier = value;
- }
- }
-
- public int StorageSpaceUsageInMB
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.storageSpaceUsageInMB;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("StorageSpaceUsageInMB"));
- }
- this.storageSpaceUsageInMB = value;
- }
- }
-
-
- public int ReservedStorageSizeMB
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.reservedStorageSizeMB;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("ReservedStorageSizeMB"));
- }
- this.reservedStorageSizeMB = value;
- }
- }
-
-
- public NumericServerProperty MinMemory
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.minMemory;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("MinMemory"));
- }
-
- this.minMemory = value;
- }
- }
-
- public NumericServerProperty MaxMemory
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.maxMemory;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("MaxMemory"));
- }
-
- this.maxMemory = value;
- }
- }
-
- public bool AutoProcessorAffinityMaskForAll
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.autoProcessorAffinityMaskForAll;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("AutoProcessorAffinityMaskForAll"));
- }
-
- this.autoProcessorAffinityMaskForAll = value;
- }
- }
-
- public bool AutoProcessorAffinityIOMaskForAll
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.autoProcessorAffinityIOMaskForAll;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("AutoProcessorAffinityIOMaskForAll"));
- }
-
- this.autoProcessorAffinityIOMaskForAll = value;
- }
- }
-
- public List NumaNodes
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.numaNodes;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("NumaNodes"));
- }
-
- this.numaNodes = value;
- }
- }
-
- public ServerLoginMode AuthenticationMode
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.authenticationMode;
- }
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("AuthenticationMode"));
- }
-
- this.authenticationMode = value;
- }
- }
-
- public AuditLevel LoginAuditing
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.loginAuditing;
- }
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("LoginAuditing"));
- }
-
- this.loginAuditing = value;
- }
- }
-
- public Microsoft.SqlServer.Management.Smo.Server Server
- {
- get
- {
- return this.server;
- }
- }
-
- public bool IsYukonOrLater
- {
- get
- {
- return this.isYukonOrLater;
- }
- }
-
- public AffinityManager AffinityManagerIOMask
- {
- get
- {
- return this.affinityManagerIOMask;
- }
-
- set
- {
- this.affinityManagerIOMask = value;
- }
- }
-
- public AffinityManager AffinityManagerProcessorMask
- {
- get
- {
- return this.affinityManagerProcessorMask;
- }
-
- set
- {
- this.affinityManagerProcessorMask = value;
- }
- }
- public bool CheckBackupChecksum
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.checkBackupChecksum;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("CheckBackupChecksum"));
- }
- this.checkBackupChecksum = value;
- }
- }
- public bool CheckCompressBackup
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.checkCompressBackup;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("CheckCompressBackup"));
- }
- this.checkCompressBackup = value;
- }
- }
-
- public string DataLocation
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.dataLocation;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("DataLocation"));
- }
- this.dataLocation = value;
- }
- }
-
- public string LogLocation
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.logLocation;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("LogLocation"));
- }
- this.logLocation = value;
- }
- }
-
- public string BackupLocation
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.backupLocation;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("BackupLocation"));
- }
- this.backupLocation = value;
- }
- }
-
- public bool AllowTriggerToFireOthers
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.allowTriggerToFireOthers;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("AllowTriggerToFireOthers"));
- }
- this.allowTriggerToFireOthers = value;
- }
- }
-
- public NumericServerProperty BlockedProcThreshold
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.blockedProcThreshold;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("BlockedProcThreshold"));
- }
-
- this.blockedProcThreshold = value;
- }
- }
-
- public NumericServerProperty CursorThreshold
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.cursorThreshold;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("CursorThreshold"));
- }
-
- this.cursorThreshold = value;
- }
- }
-
- public string DefaultFullTextLanguage
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.defaultFullTextLanguage;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("DefaultFullTextLanguage"));
- }
- this.defaultFullTextLanguage = value;
- }
- }
-
- public string DefaultLanguage
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.defaultLanguage;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("DefaultLanguage"));
- }
- this.defaultLanguage = value;
- }
- }
-
- public string FullTextUpgradeOption
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.fullTextUpgradeOption;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("FullTextUpgradeOption"));
- }
- this.fullTextUpgradeOption = value;
- }
- }
-
- public NumericServerProperty MaxTextReplicationSize
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.maxTextReplicationSize;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("MaxTextReplicationSize"));
- }
-
- this.maxTextReplicationSize = value;
- }
- }
-
- public bool OptimizeAdHocWorkloads
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.optimizeAdHocWorkloads;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("OptimizeAdHocWorkloads"));
- }
- this.optimizeAdHocWorkloads = value;
- }
- }
-
- public bool ScanStartupProcs
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.scanStartupProcs;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("ScanStartupProcs"));
- }
- this.scanStartupProcs = value;
- }
- }
-
- public int TwoDigitYearCutoff
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.twoDigitYearCutoff;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("TwoDigitYearCutoff"));
- }
- this.twoDigitYearCutoff = value;
- }
- }
-
- public NumericServerProperty CostThresholdParallelism
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.costThresholdParallelism;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("CostThresholdParallelism"));
- }
- this.costThresholdParallelism = value;
- }
- }
-
- public NumericServerProperty Locks
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.locks;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("Locks"));
- }
- this.locks = value;
- }
- }
-
- public NumericServerProperty MaxDegreeParallelism
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.maxDegreeParallelism;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("MaxDegreeParallelism"));
- }
- this.maxDegreeParallelism = value;
- }
- }
-
- public NumericServerProperty QueryWait
- {
- get
- {
- if (!this.initialized)
- {
- LoadData();
- }
-
- return this.queryWait;
- }
-
- set
- {
- if (this.initialized)
- {
- Logger.Error(SR.PropertyNotInitialized("QueryWait"));
- }
- this.queryWait = value;
- }
- }
-
- #endregion
-
- ///
- /// private default constructor - used by Clone()
- ///
- private ServerPrototypeData()
- {
- }
-
-
- ///
- /// constructor
- ///
- /// The context in which we are modifying an existing server
- /// The server we are modifying
- public ServerPrototypeData(CDataContainer context, Server server, ServerConfigService service)
- {
- this.server = context.Server;
- this.context = context;
- this.configService = service;
- this.isYukonOrLater = (this.server.Information.Version.Major >= 9);
- this.isSqlServer64Bit = (this.server.Edition.Contains("(64 - bit)"));
- this.affinityManagerIOMask = new AffinityManager();
- this.affinityManagerProcessorMask = new AffinityManager();
- this.minMemory = new NumericServerProperty();
- this.maxMemory = new NumericServerProperty();
- this.blockedProcThreshold = new NumericServerProperty();
- this.cursorThreshold = new NumericServerProperty();
- this.maxTextReplicationSize = new NumericServerProperty();
- this.costThresholdParallelism = new NumericServerProperty();
- this.locks = new NumericServerProperty();
- this.maxDegreeParallelism = new NumericServerProperty();
- this.queryWait = new NumericServerProperty();
- this.NumaNodes = new List();
- LoadData();
- }
-
- ///
- /// Create a clone of this ServerRolePrototypeData object
- ///
- /// The clone ServerRolePrototypeData object
- public object Clone()
- {
- ServerPrototypeData result = new ServerPrototypeData();
- result.serverName = this.serverName;
- result.initialized = this.initialized;
- result.hardwareGeneration = this.hardwareGeneration;
- result.language = this.language;
- result.memoryInMB = this.memoryInMB;
- result.operatingSystem = this.operatingSystem;
- result.platform = this.platform;
- result.processors = this.processors;
- result.isClustered = this.isClustered;
- result.isHadrEnabled = this.isHadrEnabled;
- result.isPolyBaseInstalled = this.isPolyBaseInstalled;
- result.isXTPSupported = this.isXTPSupported;
- result.product = this.product;
- result.reservedStorageSizeMB = this.reservedStorageSizeMB;
- result.rootDirectory = this.rootDirectory;
- result.serverCollation = this.serverCollation;
- result.serviceTier = this.serviceTier;
- result.storageSpaceUsageInMB = this.storageSpaceUsageInMB;
- result.version = this.version;
- result.maxMemory = this.maxMemory;
- result.minMemory = this.minMemory;
- result.autoProcessorAffinityMaskForAll = this.autoProcessorAffinityMaskForAll;
- result.autoProcessorAffinityIOMaskForAll = this.autoProcessorAffinityIOMaskForAll;
- result.numaNodes = this.numaNodes;
- result.authenticationMode = this.authenticationMode;
- result.loginAuditing = this.loginAuditing;
- result.checkBackupChecksum = this.checkBackupChecksum;
- result.checkCompressBackup = this.checkCompressBackup;
- result.dataLocation = this.dataLocation;
- result.logLocation = this.logLocation;
- result.backupLocation = this.backupLocation;
- result.allowTriggerToFireOthers = this.allowTriggerToFireOthers;
- result.blockedProcThreshold = this.blockedProcThreshold;
- result.cursorThreshold = this.cursorThreshold;
- result.defaultFullTextLanguage = this.defaultFullTextLanguage;
- result.defaultLanguage = this.defaultLanguage;
- result.fullTextUpgradeOption = this.fullTextUpgradeOption;
- result.maxTextReplicationSize = this.maxTextReplicationSize;
- result.optimizeAdHocWorkloads = this.optimizeAdHocWorkloads;
- result.scanStartupProcs = this.scanStartupProcs;
- result.twoDigitYearCutoff = this.twoDigitYearCutoff;
- result.costThresholdParallelism = this.costThresholdParallelism;
- result.locks = this.locks;
- result.maxDegreeParallelism = this.maxDegreeParallelism;
- result.queryWait = this.queryWait;
- result.server = this.server;
- return result;
- }
-
- private void LoadData()
- {
- this.initialized = true;
- LoadGeneralProperties();
- LoadMemoryProperties();
- LoadProcessorsProperties();
- LoadSecurityProperties();
- LoadDBSettingsProperties();
- LoadAdvancedProperties();
- }
-
- private void LoadGeneralProperties()
- {
- this.serverName = server.Name;
- this.hardwareGeneration = server.HardwareGeneration;
- this.language = server.Language;
- this.memoryInMB = server.PhysicalMemory;
- this.operatingSystem = server.HostDistribution;
- this.platform = server.HostPlatform;
- this.processors = server.Processors;
- this.isClustered = server.IsClustered;
- this.isHadrEnabled = server.IsHadrEnabled;
- this.isPolyBaseInstalled = server.IsPolyBaseInstalled;
- this.isXTPSupported = server.IsXTPSupported;
- this.product = server.Product;
- this.rootDirectory = server.RootDirectory;
- this.serverCollation = server.Collation;
- this.version = server.VersionString;
- this.reservedStorageSizeMB = server.ReservedStorageSizeMB;
- this.serviceTier = server.ServiceTier;
- this.storageSpaceUsageInMB = server.UsedStorageSizeMB;
- }
- private void LoadMemoryProperties()
- {
- this.maxMemory.Value = server.Configuration.MaxServerMemory.ConfigValue;
- this.maxMemory.MaximumValue = server.Configuration.MaxServerMemory.Maximum;
- this.maxMemory.MinimumValue = server.Configuration.MaxServerMemory.Minimum;
-
- this.minMemory.Value = server.Configuration.MinServerMemory.ConfigValue;
- this.minMemory.MaximumValue = server.Configuration.MinServerMemory.Maximum;
- this.minMemory.MinimumValue = server.Configuration.MinServerMemory.Minimum;
- }
-
- private void LoadProcessorsProperties()
- {
- try
- {
- this.affinityManagerIOMask.InitializeAffinity(this.server.Configuration.AffinityIOMask, this.server.Configuration.Affinity64IOMask);
- this.isIOAffinitySupported = true;
- }
- catch
- {
- this.isIOAffinitySupported = false;
- }
- this.affinityManagerProcessorMask.InitializeAffinity(this.server.Configuration.AffinityMask, this.server.Configuration.Affinity64Mask);
-
- this.numaNodes = GetNumaNodes();
- GetAutoProcessorsAffinity();
- }
-
- private void LoadSecurityProperties()
- {
- this.authenticationMode = server.LoginMode;
- this.loginAuditing = server.AuditLevel;
- }
-
- private void LoadDBSettingsProperties()
- {
- this.checkBackupChecksum = server.Configuration.DefaultBackupChecksum.ConfigValue == 1;
- this.checkCompressBackup = server.Configuration.DefaultBackupCompression.ConfigValue == 1;
- this.dataLocation = server.Settings.DefaultFile;
- this.logLocation = server.Settings.DefaultLog;
- this.backupLocation = server.Settings.BackupDirectory;
- }
-
- private void LoadAdvancedProperties()
- {
- this.allowTriggerToFireOthers = server.Configuration.NestedTriggers.ConfigValue == 1;
- this.blockedProcThreshold.Value = server.Configuration.BlockedProcessThreshold.ConfigValue;
- this.blockedProcThreshold.MinimumValue = server.Configuration.BlockedProcessThreshold.Minimum;
- this.blockedProcThreshold.MaximumValue = server.Configuration.BlockedProcessThreshold.Maximum;
- this.cursorThreshold.Value = server.Configuration.CursorThreshold.ConfigValue;
- this.cursorThreshold.MinimumValue = server.Configuration.CursorThreshold.Minimum;
- this.cursorThreshold.MaximumValue = server.Configuration.CursorThreshold.Maximum;
- this.defaultFullTextLanguage = LanguageUtils.GetLanguageChoiceAlias(server, server.Configuration.DefaultFullTextLanguage.ConfigValue).alias;
- var defaultLanguageLcid = LanguageUtils.GetLcidFromLangId(server, server.Configuration.DefaultLanguage.ConfigValue);
- this.defaultLanguage = (LanguageUtils.GetLanguageChoiceAlias(server, defaultLanguageLcid)).ToString();
- this.maxTextReplicationSize.Value = server.Configuration.ReplicationMaxTextSize.ConfigValue;
- this.maxTextReplicationSize.MinimumValue = server.Configuration.ReplicationMaxTextSize.Minimum;
- this.maxTextReplicationSize.MaximumValue = server.Configuration.ReplicationMaxTextSize.Maximum;
- this.optimizeAdHocWorkloads = server.Configuration.OptimizeAdhocWorkloads.ConfigValue == 1;
- this.scanStartupProcs = server.Configuration.ScanForStartupProcedures.ConfigValue == 1;
- this.twoDigitYearCutoff = server.Configuration.TwoDigitYearCutoff.ConfigValue;
- this.costThresholdParallelism.Value = server.Configuration.CostThresholdForParallelism.ConfigValue;
- this.costThresholdParallelism.MinimumValue = server.Configuration.CostThresholdForParallelism.Minimum;
- this.costThresholdParallelism.MaximumValue = server.Configuration.CostThresholdForParallelism.Maximum;
- this.locks.Value = server.Configuration.Locks.ConfigValue;
- this.locks.MinimumValue = server.Configuration.Locks.Minimum;
- this.locks.MaximumValue = server.Configuration.Locks.Maximum;
- this.maxDegreeParallelism.Value = server.Configuration.MaxDegreeOfParallelism.ConfigValue;
- this.maxDegreeParallelism.MinimumValue = server.Configuration.MaxDegreeOfParallelism.Minimum;
- this.maxDegreeParallelism.MaximumValue = server.Configuration.MaxDegreeOfParallelism.Maximum;
- this.queryWait.Value = server.Configuration.QueryWait.ConfigValue;
- this.queryWait.MinimumValue = server.Configuration.QueryWait.Minimum;
- this.queryWait.MaximumValue = server.Configuration.QueryWait.Maximum;
- try
- {
- this.fullTextUpgradeOption = server.FullTextService.CatalogUpgradeOption.ToString();
- }
- catch
- {
- this.fullTextUpgradeOption = String.Empty;
- }
- }
-
- ///
- /// Get affinity masks for first 32 and next 32 processors (total 64 processors) if the
- /// processor masks have been modified after being read from the server.
- ///
- /// returns the affinity for first 32 processors. null if not changed
- /// return the affinity for CPUs 33-64. null if not changed.
- private List GetNumaNodes()
- {
- List results = new List();
- foreach (SMO.NumaNode node in this.server.AffinityInfo.NumaNodes)
- {
- var processors = new List();
- foreach (SMO.Cpu cpu in node.Cpus)
- {
- if (cpu.GroupID == 0)
- {
- var affinityIO = this.AffinityManagerIOMask.GetAffinity(cpu.ID, true);
- if (!cpu.AffinityMask && this.isIOAffinitySupported && affinityIO) // if it's false then check if io affinity is checked
- {
- this.AffinityManagerIOMask.initialIOAffinityArray[cpu.ID] = true;
- }
-
- // get affinityIO info if group id is 0
- processors.Add(new ProcessorAffinity() { ProcessorId = cpu.ID.ToString(), Affinity = cpu.AffinityMask, IOAffinity = affinityIO });
- }
- }
- var result = new NumaNode() { NumaNodeId = node.ID.ToString(), Processors = processors };
- results.Add(result);
- }
- return results;
- }
-
- private void GetAutoProcessorsAffinity()
- {
- if (this.server.AffinityInfo.AffinityType == Microsoft.SqlServer.Management.Smo.AffinityType.Auto)
- {
- this.autoProcessorAffinityMaskForAll = this.autoProcessorAffinityIOMaskForAll = true;
- }
- else
- {
- this.autoProcessorAffinityMaskForAll = this.autoProcessorAffinityIOMaskForAll = false;
- }
- }
- }
}
}
\ No newline at end of file
diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype130.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype130.cs
new file mode 100644
index 00000000..67dba6cc
--- /dev/null
+++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype130.cs
@@ -0,0 +1,34 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+using Microsoft.SqlServer.Management.Common;
+using Microsoft.SqlServer.Management.Smo;
+
+namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
+{
+ internal class ServerPrototype130 : ServerPrototype
+ {
+ public ServerPrototype130(Server server, ServerConnection connection) : base(server, connection) { }
+
+ public bool IsPolyBaseInstalled
+ {
+ get
+ {
+ return this.currentState.IsPolyBaseInstalled;
+ }
+ set
+ {
+ this.currentState.IsPolyBaseInstalled = value;
+ }
+ }
+
+ public override void ApplyInfoToPrototype(ServerInfo serverInfo)
+ {
+ base.ApplyInfoToPrototype(serverInfo);
+
+ this.IsPolyBaseInstalled = serverInfo.IsPolyBaseInstalled.GetValueOrDefault();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype140.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype140.cs
new file mode 100644
index 00000000..6a41d26b
--- /dev/null
+++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype140.cs
@@ -0,0 +1,47 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+using Microsoft.SqlServer.Management.Common;
+using Microsoft.SqlServer.Management.Smo;
+
+namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
+{
+ internal class ServerPrototype140 : ServerPrototype130
+ {
+ public ServerPrototype140(Server server, ServerConnection connection) : base(server, connection) { }
+
+ public string OperatingSystem
+ {
+ get
+ {
+ return this.currentState.OperatingSystem;
+ }
+ set
+ {
+ this.currentState.OperatingSystem = value;
+ }
+ }
+
+ public string Platform
+ {
+ get
+ {
+ return this.currentState.Platform;
+ }
+ set
+ {
+ this.currentState.Platform = value;
+ }
+ }
+
+ public override void ApplyInfoToPrototype(ServerInfo serverInfo)
+ {
+ base.ApplyInfoToPrototype(serverInfo);
+
+ this.OperatingSystem = serverInfo.OperatingSystem;
+ this.Platform = serverInfo.Platform;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototypeMI.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototypeMI.cs
new file mode 100644
index 00000000..bb2de961
--- /dev/null
+++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototypeMI.cs
@@ -0,0 +1,77 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+using Microsoft.SqlServer.Management.Common;
+using Microsoft.SqlServer.Management.Smo;
+
+namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
+{
+ ///
+ /// Prototype for representing a manage instance server.
+ ///
+ internal class ServerPrototypeMI : ServerPrototype140
+ {
+ public ServerPrototypeMI(Server server, ServerConnection connection) : base(server, connection) { }
+
+ public string HardwareGeneration
+ {
+ get
+ {
+ return this.currentState.HardwareGeneration;
+ }
+ set
+ {
+ this.currentState.HardwareGeneration = value;
+ }
+ }
+
+ public string ServiceTier
+ {
+ get
+ {
+ return this.currentState.ServiceTier;
+ }
+ set
+ {
+ this.currentState.ServiceTier = value;
+ }
+ }
+
+ public int StorageSpaceUsageInMB
+ {
+ get
+ {
+ return this.currentState.StorageSpaceUsageInMB;
+ }
+ set
+ {
+ this.currentState.StorageSpaceUsageInMB = value;
+ }
+ }
+
+
+ public int ReservedStorageSizeMB
+ {
+ get
+ {
+ return this.currentState.ReservedStorageSizeMB;
+ }
+ set
+ {
+ this.currentState.ReservedStorageSizeMB = value;
+ }
+ }
+
+ public override void ApplyInfoToPrototype(ServerInfo serverInfo)
+ {
+ base.ApplyInfoToPrototype(serverInfo);
+
+ this.HardwareGeneration = serverInfo.HardwareGeneration;
+ this.ServiceTier = serverInfo.ServiceTier;
+ this.ReservedStorageSizeMB = serverInfo.ReservedStorageSizeMB.GetValueOrDefault();
+ this.StorageSpaceUsageInMB = serverInfo.StorageSpaceUsageInMB.GetValueOrDefault();
+ }
+ }
+}
\ No newline at end of file