diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Security/NetStandardUtils.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Security/NetStandardUtils.cs index b912a078..eb69ce08 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Security/NetStandardUtils.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Security/NetStandardUtils.cs @@ -111,18 +111,11 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement public static bool IsXTPSupportedOnServer(SMO.Server server) { - if(server.DatabaseEngineEdition == DatabaseEngineEdition.SqlOnDemand) + if (server.DatabaseEngineEdition == DatabaseEngineEdition.SqlOnDemand) { return false; } - bool isXTPSupported = false; - - if (server.ConnectionContext.ExecuteScalar("SELECT SERVERPROPERTY('IsXTPSupported')") != DBNull.Value) - { - isXTPSupported = server.IsXTPSupported; - } - - return isXTPSupported; + return server.IsSupportedProperty(nameof(server.IsXTPSupported)) && server.IsXTPSupported; } public static bool IsPolybasedInstalledOnServer(SMO.Server server) diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerData.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerData.cs index b491ab13..881ea616 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerData.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerData.cs @@ -1199,7 +1199,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement this.processors = server.Processors; this.isClustered = server.IsClustered; this.isHadrEnabled = server.IsHadrEnabled; - this.isPolyBaseInstalled = server.IsPolyBaseInstalled; this.product = server.Product; this.rootDirectory = server.RootDirectory; @@ -1212,19 +1211,25 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement this.reservedStorageSizeMB = server.ReservedStorageSizeMB; this.storageSpaceUsageInMB = server.UsedStorageSizeMB; } + if (server.VersionMajor < 14 || server.HostPlatform == null) + { + this.platform = server.Platform; + this.operatingSystem = "Microsoft Windows NT " + + Convert.ToString(server.OSVersion, System.Globalization.CultureInfo.InvariantCulture); + } else { - this.isXTPSupported = server.IsXTPSupported; - } - if (server.VersionMajor >= 14) - { - this.operatingSystem = server.HostDistribution; this.platform = server.HostPlatform; + this.operatingSystem = $"{server.HostDistribution} ({server.HostRelease})"; } if (server.VersionMajor >= 13) { this.isPolyBaseInstalled = server.IsPolyBaseInstalled; } + if (Utils.IsXTPSupportedOnServer(server)) + { + this.isXTPSupported = server.IsXTPSupported; + } } private void LoadMemoryProperties() diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerHandler.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerHandler.cs index b3b1522c..492d72e0 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerHandler.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerHandler.cs @@ -48,6 +48,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement Name = prototype.Name, Language = prototype.Language, MemoryInMB = prototype.MemoryInMB, + OperatingSystem = prototype.OperatingSystem, + Platform = prototype.Platform, Processors = prototype.Processors, IsClustered = prototype.IsClustered, IsHadrEnabled = prototype.IsHadrEnabled, @@ -90,11 +92,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement 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; @@ -169,11 +166,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement { prototype = new ServerPrototypeMI(server, connection); } - else if (server.VersionMajor >= 14) - { - prototype = new ServerPrototype140(server, connection); - } - else if (server.VersionMajor == 13) + else if (server.VersionMajor >= 13) { prototype = new ServerPrototype130(server, connection); } diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype.cs index 4d62b3e6..a6a331df 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype.cs @@ -53,6 +53,19 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement } } + + public string OperatingSystem + { + get + { + return this.currentState.OperatingSystem; + } + set + { + this.currentState.OperatingSystem = value; + } + } + public string Version { get @@ -77,6 +90,18 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement } } + public string Platform + { + get + { + return this.currentState.Platform; + } + set + { + this.currentState.Platform = value; + } + } + public int MemoryInMB { get @@ -924,6 +949,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement 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; diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype140.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype140.cs deleted file mode 100644 index 6a41d26b..00000000 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototype140.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// 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 index bb2de961..94ed7386 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototypeMI.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Server/ServerPrototypeMI.cs @@ -11,7 +11,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement /// /// Prototype for representing a manage instance server. /// - internal class ServerPrototypeMI : ServerPrototype140 + internal class ServerPrototypeMI : ServerPrototype130 { public ServerPrototypeMI(Server server, ServerConnection connection) : base(server, connection) { }