From 73c2a75fbaa903ea50f135f6f99fbf24e07a3523 Mon Sep 17 00:00:00 2001 From: Aasim Khan Date: Thu, 17 Aug 2023 05:11:35 +0000 Subject: [PATCH] Creating a new Sql Core project that stores OE classes. (#2165) * init * More fixes * moving filters from contracts to core OE classes * Fixing some tests * More fixes and added doc comments * Fixing tests * Quick refactoring * more cleanups * cleanup * Adding stateless OE * Adding null checks * Making group by schema independent of settings * Fixing tests * Removing node info from core oe code * Fixing tests and moving OE code to its own project * moving oe to own project * Removing changes to Kusto * Removing azure access token from service layer * Fixing project description and title * Fixing file name typo * Removing unused strings from service layer * Fixing localized strings in tests Adding comments to stateless OE * Fixing stuff * Update src/Microsoft.SqlTools.SqlCore/Microsoft.SqlTools.SqlCore.csproj Co-authored-by: Charles Gagnon * Fixing project nesting * Fixing more stuff and removing OE class * Cleanup * Code cleanup * fixing oe service provider * Fixing test name * Remove using * Update src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoQueryContext.cs Co-authored-by: Charles Gagnon * Fixing syntax error * Adding project to locproject * Fixing stuff * Fixing errors * sorting usings --------- Co-authored-by: Charles Gagnon --- sqltoolsservice.sln | 9 + src/LocProject.json | 6 + .../Admin/Database/DatabasePrototypeAzure.cs | 3 +- .../Connection/ConnectionInfo.cs | 1 + .../Connection/ConnectionService.cs | 21 +- .../Connection/ListDatabaseRequestHandler.cs | 2 +- .../EditData/SmoEditMetadataFactory.cs | 2 +- .../HostLoader.cs | 3 +- .../ExternalLanguageOperations.cs | 10 +- .../Localization/sr.cs | 2332 ---------------- .../Localization/sr.resx | 848 ------ .../Localization/sr.strings | 410 --- .../Localization/sr.xlf | 1060 -------- .../Management/Common/Utils.cs | 100 +- .../Metadata/Contracts/MetadataListRequest.cs | 1 + .../Metadata/MetadataService.cs | 1 + .../Metadata/SmoMetadataFactory.cs | 2 +- .../Microsoft.SqlTools.ServiceLayer.csproj | 4 +- .../ModelManagement/ModelOperations.cs | 55 +- .../ObjectExplorer/Contracts/ExpandRequest.cs | 2 +- .../ObjectExplorer/Contracts/NodeInfo.cs | 180 +- .../ObjectExplorer/ObjectExplorerService.cs | 102 +- .../ObjectExplorer/ObjectExplorerUtils.cs | 111 +- .../ObjectTypes/Database/DatabaseHandler.cs | 3 +- .../Scripting/ScriptAsScriptingOperation.cs | 18 +- .../Scripting/SmoScriptingOperation.cs | 10 +- .../SqlAssessment/GenerateScriptOperation.cs | 4 +- .../Utility/DatabaseUtils.cs | 5 +- .../Connection/AzureAccessToken.cs | 32 + .../Connection}/SecurityToken.cs | 4 +- .../Localization/sr.cs | 2394 +++++++++++++++++ .../Localization/sr.resx | 968 +++++++ .../Localization/sr.strings | 432 +++ .../Localization/sr.xlf | 1067 ++++++++ .../Metadata}/ObjectMetadata.cs | 4 +- .../Microsoft.SqlTools.SqlCore.csproj | 39 + .../ObjectExplorer/IObjectExplorerSession.cs | 14 + .../ObjectExplorer/Nodes/ChildFactory.cs | 9 +- .../ObjectExplorer/Nodes/INodeFilter.cs | 2 +- .../Nodes/NodeFilterProperty.cs | 66 + .../Nodes/NodeObservableCollection.cs | 8 +- .../ObjectExplorer/Nodes/NodeOrFilter.cs | 4 +- .../Nodes/NodePropertyFilter.cs | 9 +- .../ObjectExplorer/Nodes/NodeSmoProperty.cs | 5 +- .../ObjectExplorer/Nodes/NodeTypes.cs | 2 +- .../ObjectExplorer/Nodes/NodeTypes.tt | 2 +- .../ObjectExplorer/Nodes/TreeNode.cs | 90 +- .../Nodes/TreeNodeWithContext.cs | 2 +- .../ObjectExplorer/ObjectExplorerOptions.cs | 22 + .../ObjectExplorerServerInfo.cs | 42 + .../ObjectExplorer/ObjectExplorerUtils.cs | 78 + .../SmoModel/DatabaseTreeNode.cs | 11 +- .../ObjectExplorer/SmoModel/FolderNode.cs | 6 +- .../SmoModel/NodePathGenerator.cs | 15 +- .../ObjectExplorer/SmoModel/ServerNode.cs | 48 +- .../SmoModel/SmoChildFactoryBase.cs | 709 +++-- .../SmoModel/SmoCollectionWrapper.cs | 4 +- .../SmoModel/SmoColumnCustomNode.cs | 6 +- .../SmoModel/SmoDatabaseCustomNode.cs | 6 +- .../ObjectExplorer/SmoModel/SmoExtensions.cs | 5 +- .../SmoModel/SmoKeyCustomNode.cs | 6 +- .../SmoModel/SmoLoginCustomNode.cs | 6 +- .../SmoModel/SmoParamterCustomNode.cs | 4 +- .../ObjectExplorer/SmoModel/SmoQuerier.cs | 185 +- .../SmoModel/SmoQueryContext.cs | 41 +- .../ObjectExplorer/SmoModel/SmoQueryModel.cs | 6 +- .../ObjectExplorer/SmoModel/SmoQueryModel.tt | 6 +- .../SmoModel/SmoQueryModelDefinition.xml | 0 .../SmoModel/SmoTableCustomNode.cs | 4 +- .../ObjectExplorer/SmoModel/SmoTreeNode.cs | 250 +- .../ObjectExplorer/SmoModel/SmoTreeNodes.cs | 130 +- .../ObjectExplorer/SmoModel/SmoTreeNodes.tt | 161 +- .../SmoModel/SmoTreeNodesDefinition.xml | 1 - .../SmoModel/SmoTriggerCustomNode.cs | 6 +- .../SmoModel/SmoUserCustomNode.cs | 6 +- .../SmoModel/SmoViewCustomNode.cs | 3 +- .../ObjectExplorer/SmoModel/SmoWrapper.cs | 4 +- .../SmoModel/SqlHistoryTableQuerier.cs | 4 +- .../SmoModel/SystemDataTypeChildFactories.cs | 6 +- .../ObjectExplorer/SqlServerType.cs | 7 +- .../ObjectExplorer/StatelessObjectExplorer.cs | 119 + .../ObjectExplorer/ValidForFlag.cs | 4 +- .../Utility/CommonConstants.cs | 5 +- .../Utility/DatabaseUtils.cs | 27 + .../Utility/Utils.cs | 109 + .../Metadata/MetadataServiceTests.cs | 1 + .../ObjectExplorerServiceTests.cs | 72 +- .../StatelessObjectExplorerServiceTests.cs | 84 + ...oft.SqlTools.ServiceLayer.UnitTests.csproj | 1 + .../ObjectExplorer/GroupBySchemaTests.cs | 31 +- .../ObjectExplorer/NodeFilterTests.cs | 8 +- .../ObjectExplorer/NodePathGeneratorTests.cs | 8 +- .../ObjectExplorer/NodeTests.cs | 117 +- .../ObjectExplorerServiceTests.cs | 6 +- .../ObjectExplorer/ObjectExplorerTestBase.cs | 4 +- .../ServerVersionHelperTests.cs | 7 +- .../ObjectExplorer/SmoQueryModelTests.cs | 20 +- .../ObjectExplorer/UsersChildFactoryTests.cs | 2 +- 98 files changed, 6755 insertions(+), 6116 deletions(-) create mode 100644 src/Microsoft.SqlTools.SqlCore/Connection/AzureAccessToken.cs rename src/{Microsoft.SqlTools.ServiceLayer/Connection/Contracts => Microsoft.SqlTools.SqlCore/Connection}/SecurityToken.cs (88%) create mode 100644 src/Microsoft.SqlTools.SqlCore/Localization/sr.cs create mode 100644 src/Microsoft.SqlTools.SqlCore/Localization/sr.resx create mode 100644 src/Microsoft.SqlTools.SqlCore/Localization/sr.strings create mode 100644 src/Microsoft.SqlTools.SqlCore/Localization/sr.xlf rename src/{Microsoft.SqlTools.ServiceLayer/Metadata/Contracts => Microsoft.SqlTools.SqlCore/Metadata}/ObjectMetadata.cs (91%) create mode 100644 src/Microsoft.SqlTools.SqlCore/Microsoft.SqlTools.SqlCore.csproj create mode 100644 src/Microsoft.SqlTools.SqlCore/ObjectExplorer/IObjectExplorerSession.cs rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/Nodes/ChildFactory.cs (92%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/Nodes/INodeFilter.cs (97%) create mode 100644 src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeFilterProperty.cs rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/Nodes/NodeObservableCollection.cs (97%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/Nodes/NodeOrFilter.cs (96%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/Nodes/NodePropertyFilter.cs (98%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/Nodes/NodeSmoProperty.cs (87%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/Nodes/NodeTypes.cs (98%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/Nodes/NodeTypes.tt (98%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/Nodes/TreeNode.cs (86%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/Nodes/TreeNodeWithContext.cs (77%) create mode 100644 src/Microsoft.SqlTools.SqlCore/ObjectExplorer/ObjectExplorerOptions.cs create mode 100644 src/Microsoft.SqlTools.SqlCore/ObjectExplorer/ObjectExplorerServerInfo.cs create mode 100644 src/Microsoft.SqlTools.SqlCore/ObjectExplorer/ObjectExplorerUtils.cs rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/DatabaseTreeNode.cs (94%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/FolderNode.cs (88%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/NodePathGenerator.cs (92%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/ServerNode.cs (74%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs (90%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoCollectionWrapper.cs (95%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoColumnCustomNode.cs (98%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoDatabaseCustomNode.cs (97%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoExtensions.cs (88%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoKeyCustomNode.cs (96%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoLoginCustomNode.cs (90%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoParamterCustomNode.cs (98%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoQuerier.cs (83%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoQueryContext.cs (83%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoQueryModel.cs (99%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoQueryModel.tt (98%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoQueryModelDefinition.xml (100%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoTableCustomNode.cs (98%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoTreeNode.cs (88%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoTreeNodes.cs (98%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoTreeNodes.tt (89%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoTreeNodesDefinition.xml (99%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoTriggerCustomNode.cs (95%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoUserCustomNode.cs (90%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoViewCustomNode.cs (97%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SmoWrapper.cs (96%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SqlHistoryTableQuerier.cs (92%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SmoModel/SystemDataTypeChildFactories.cs (98%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/SqlServerType.cs (96%) create mode 100644 src/Microsoft.SqlTools.SqlCore/ObjectExplorer/StatelessObjectExplorer.cs rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/ObjectExplorer/ValidForFlag.cs (94%) rename src/{Microsoft.SqlTools.ServiceLayer => Microsoft.SqlTools.SqlCore}/Utility/CommonConstants.cs (94%) create mode 100644 src/Microsoft.SqlTools.SqlCore/Utility/DatabaseUtils.cs create mode 100644 src/Microsoft.SqlTools.SqlCore/Utility/Utils.cs create mode 100644 test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/ObjectExplorer/StatelessObjectExplorerServiceTests.cs diff --git a/sqltoolsservice.sln b/sqltoolsservice.sln index a25b129d..30025286 100644 --- a/sqltoolsservice.sln +++ b/sqltoolsservice.sln @@ -50,6 +50,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.SqlTools.Credenti EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.SqlTools.Hosting", "src\Microsoft.SqlTools.Hosting\Microsoft.SqlTools.Hosting.csproj", "{AAE1F8D1-F7AB-4ABE-A55B-D423393AB352}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.SqlTools.SqlCore", "src\Microsoft.SqlTools.SqlCore\Microsoft.SqlTools.SqlCore.csproj", "{C175C3D4-1AE1-4B62-85EF-8298D37F2BAC}" +EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.SqlTools.ServiceLayer", "src\Microsoft.SqlTools.ServiceLayer\Microsoft.SqlTools.ServiceLayer.csproj", "{835EDEB4-289B-4D6D-A9A0-609E43A87D6E}" ProjectSection(ProjectDependencies) = postProject {3F82F298-700A-48DF-8A69-D048DFBA782C} = {3F82F298-700A-48DF-8A69-D048DFBA782C} @@ -118,6 +120,12 @@ Global {AAE1F8D1-F7AB-4ABE-A55B-D423393AB352}.Integration|Any CPU.Build.0 = Debug|Any CPU {AAE1F8D1-F7AB-4ABE-A55B-D423393AB352}.Release|Any CPU.ActiveCfg = Release|Any CPU {AAE1F8D1-F7AB-4ABE-A55B-D423393AB352}.Release|Any CPU.Build.0 = Release|Any CPU + {C175C3D4-1AE1-4B62-85EF-8298D37F2BAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C175C3D4-1AE1-4B62-85EF-8298D37F2BAC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C175C3D4-1AE1-4B62-85EF-8298D37F2BAC}.Integration|Any CPU.ActiveCfg = Debug|Any CPU + {C175C3D4-1AE1-4B62-85EF-8298D37F2BAC}.Integration|Any CPU.Build.0 = Debug|Any CPU + {C175C3D4-1AE1-4B62-85EF-8298D37F2BAC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C175C3D4-1AE1-4B62-85EF-8298D37F2BAC}.Release|Any CPU.Build.0 = Release|Any CPU {835EDEB4-289B-4D6D-A9A0-609E43A87D6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {835EDEB4-289B-4D6D-A9A0-609E43A87D6E}.Debug|Any CPU.Build.0 = Debug|Any CPU {835EDEB4-289B-4D6D-A9A0-609E43A87D6E}.Integration|Any CPU.ActiveCfg = Debug|Any CPU @@ -246,6 +254,7 @@ Global {B7D21727-2926-452B-9610-3ADB0BB6D789} = {F9978D78-78FE-4E92-A7D6-D436B7683EF6} {0F761F76-E0F3-472E-B539-1815CE2BC696} = {2BBD7364-054F-4693-97CD-1C395E3E84A9} {AAE1F8D1-F7AB-4ABE-A55B-D423393AB352} = {2BBD7364-054F-4693-97CD-1C395E3E84A9} + {C175C3D4-1AE1-4B62-85EF-8298D37F2BAC} = {2BBD7364-054F-4693-97CD-1C395E3E84A9} {835EDEB4-289B-4D6D-A9A0-609E43A87D6E} = {2BBD7364-054F-4693-97CD-1C395E3E84A9} {F18471B5-2042-409D-BF2C-E5403C322DC9} = {AB9CA2B8-6F70-431C-8A1D-67479D8A7BE4} {4F250E56-F8B4-4E69-AECC-4D31EDD891E7} = {AB9CA2B8-6F70-431C-8A1D-67479D8A7BE4} diff --git a/src/LocProject.json b/src/LocProject.json index 7ac6c3ca..ef6b178b 100644 --- a/src/LocProject.json +++ b/src/LocProject.json @@ -44,6 +44,12 @@ "LclFile": "src\\Microsoft.Kusto.ServiceLayer\\Localization\\LCL\\{Lang}\\sr.xlf.lcl", "CopyOption": "LangIDOnName", "OutputPath": "src\\Microsoft.Kusto.ServiceLayer\\Localization\\transXliff" + }, + { + "SourceFile": "src\\Microsoft.SqlTools.SqlCore\\Localization\\sr.xlf", + "LclFile": "src\\Microsoft.SqlTools.SqlCore\\Localization\\LCL\\{Lang}\\sr.xlf.lcl", + "CopyOption": "LangIDOnName", + "OutputPath": "src\\Microsoft.SqlTools.SqlCore\\Localization\\transXliff" } ] } diff --git a/src/Microsoft.SqlTools.ServiceLayer/Admin/Database/DatabasePrototypeAzure.cs b/src/Microsoft.SqlTools.ServiceLayer/Admin/Database/DatabasePrototypeAzure.cs index 1c8a1b17..2fae1129 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Admin/Database/DatabasePrototypeAzure.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Admin/Database/DatabasePrototypeAzure.cs @@ -17,6 +17,7 @@ using AzureEdition = Microsoft.SqlTools.ServiceLayer.Admin.AzureSqlDbHelper.Azur using System; using System.Data; using Microsoft.SqlTools.Utility; +using Microsoft.SqlTools.SqlCore.Utility; namespace Microsoft.SqlTools.ServiceLayer.Admin { @@ -377,7 +378,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin private static string CreateAzureAlterDbStatement(string dbName, string options) { return string.Format(CultureInfo.InvariantCulture, AlterDbStatementFormat, - CUtils.EscapeString(CUtils.EscapeString(dbName, ']'), '\''), + StringUtils.EscapeString(StringUtils.EscapeString(dbName, ']'), '\''), options); } } diff --git a/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionInfo.cs b/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionInfo.cs index ea5cff08..64035c62 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionInfo.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionInfo.cs @@ -11,6 +11,7 @@ using System.Collections.Generic; using System.Data.Common; using Microsoft.SqlServer.Management.Common; using Microsoft.SqlTools.ServiceLayer.Connection.Contracts; +using Microsoft.SqlTools.SqlCore.Connection; using Microsoft.SqlTools.Utility; namespace Microsoft.SqlTools.ServiceLayer.Connection diff --git a/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs b/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs index 9029abf7..134bd06f 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs @@ -29,6 +29,7 @@ using Microsoft.SqlTools.Authentication; using System.IO; using Microsoft.SqlTools.Hosting.Utility; using Constants = Microsoft.SqlTools.Hosting.Protocol.Constants; +using Microsoft.SqlTools.SqlCore.Connection; namespace Microsoft.SqlTools.ServiceLayer.Connection { @@ -1983,24 +1984,4 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection return databaseName != null ? databaseName.IndexOf('@') != -1 : false; } } - - public class AzureAccessToken : IRenewableToken - { - public DateTimeOffset TokenExpiry { get; set; } - public string Resource { get; set; } - public string Tenant { get; set; } - public string UserId { get; set; } - - private string accessToken; - - public AzureAccessToken(string accessToken) - { - this.accessToken = accessToken; - } - - public string GetAccessToken() - { - return this.accessToken; - } - } } diff --git a/src/Microsoft.SqlTools.ServiceLayer/Connection/ListDatabaseRequestHandler.cs b/src/Microsoft.SqlTools.ServiceLayer/Connection/ListDatabaseRequestHandler.cs index 05aaed8e..3d21d1ca 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Connection/ListDatabaseRequestHandler.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Connection/ListDatabaseRequestHandler.cs @@ -11,7 +11,7 @@ using System.Data.Common; using Microsoft.SqlServer.Management.Common; using Microsoft.SqlTools.ServiceLayer.Admin.Contracts; using Microsoft.SqlTools.ServiceLayer.Connection.Contracts; -using Microsoft.SqlTools.ServiceLayer.Utility; +using Microsoft.SqlTools.SqlCore.Utility; using Microsoft.SqlTools.Utility; namespace Microsoft.SqlTools.ServiceLayer.Connection diff --git a/src/Microsoft.SqlTools.ServiceLayer/EditData/SmoEditMetadataFactory.cs b/src/Microsoft.SqlTools.ServiceLayer/EditData/SmoEditMetadataFactory.cs index 4db681d9..076b34b2 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/EditData/SmoEditMetadataFactory.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/EditData/SmoEditMetadataFactory.cs @@ -11,9 +11,9 @@ using System.Data.Common; using Microsoft.Data.SqlClient; using Microsoft.SqlServer.Management.Common; using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.Connection; using Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection; using Microsoft.SqlTools.ServiceLayer.Utility.SqlScriptFormatters; +using Microsoft.SqlTools.SqlCore.Connection; using Microsoft.SqlTools.Utility; namespace Microsoft.SqlTools.ServiceLayer.EditData diff --git a/src/Microsoft.SqlTools.ServiceLayer/HostLoader.cs b/src/Microsoft.SqlTools.ServiceLayer/HostLoader.cs index a9daffed..ab3fa505 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/HostLoader.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/HostLoader.cs @@ -82,7 +82,8 @@ namespace Microsoft.SqlTools.ServiceLayer ExtensionServiceProvider serviceProvider = ExtensionServiceProvider.CreateDefaultServiceProvider(new string[] { "microsofsqltoolscredentials.dll", "microsoft.sqltools.hosting.dll", - "microsoftsqltoolsservicelayer.dll" + "microsoftsqltoolsservicelayer.dll", + "microsoftsqltoolssqlcore.dll" }); serviceProvider.RegisterSingleService(sqlToolsContext); serviceProvider.RegisterSingleService(serviceHost); diff --git a/src/Microsoft.SqlTools.ServiceLayer/LanguageExtensibility/ExternalLanguageOperations.cs b/src/Microsoft.SqlTools.ServiceLayer/LanguageExtensibility/ExternalLanguageOperations.cs index f4ce089e..218dc475 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/LanguageExtensibility/ExternalLanguageOperations.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/LanguageExtensibility/ExternalLanguageOperations.cs @@ -6,7 +6,7 @@ #nullable disable using Microsoft.SqlTools.ServiceLayer.LanguageExtensibility.Contracts; -using Microsoft.SqlTools.ServiceLayer.Management; +using Microsoft.SqlTools.SqlCore.Utility; using Microsoft.SqlTools.Utility; using System; using System.Collections.Generic; @@ -67,7 +67,7 @@ ORDER BY platform"; private string GetDropScript(string languageName) { - return $@"{DropScript} [{CUtils.EscapeStringCBracket(languageName)}]"; + return $@"{DropScript} [{StringUtils.EscapeStringCBracket(languageName)}]"; } /// @@ -262,7 +262,7 @@ ORDER BY platform"; contentScript = $"{contentScript}{seperator}{GetLanguageContent(content, i, parameters)}"; } - string ownerScript = string.IsNullOrWhiteSpace(language.Owner) ? "" : $"AUTHORIZATION [{CUtils.EscapeStringCBracket(language.Owner)}]"; + string ownerScript = string.IsNullOrWhiteSpace(language.Owner) ? "" : $"AUTHORIZATION [{StringUtils.EscapeStringCBracket(language.Owner)}]"; string scriptAction = modifyType == ModifyType.Create ? CreateScript : AlterScript; string contentAction = "FROM"; if (modifyType == ModifyType.Alter) @@ -281,7 +281,7 @@ ORDER BY platform"; } } return $@" -{scriptAction} [{CUtils.EscapeStringCBracket(language.Name)}] +{scriptAction} [{StringUtils.EscapeStringCBracket(language.Name)}] {ownerScript} {contentAction} {contentScript} "; @@ -289,7 +289,7 @@ ORDER BY platform"; private string AddStringParameter(string paramName, string prefix, string paramValue) { - string value = string.IsNullOrWhiteSpace(paramValue) ? paramValue : CUtils.EscapeStringSQuote(paramValue); + string value = string.IsNullOrWhiteSpace(paramValue) ? paramValue : StringUtils.EscapeStringSQuote(paramValue); return $"{prefix} {paramName} = N'{value}'"; } diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs index bd8364bb..179ec783 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs @@ -821,1702 +821,6 @@ namespace Microsoft.SqlTools.ServiceLayer } } - public static string TreeNodeError - { - get - { - return Keys.GetString(Keys.TreeNodeError); - } - } - - public static string ServerNodeConnectionError - { - get - { - return Keys.GetString(Keys.ServerNodeConnectionError); - } - } - - public static string SchemaHierarchy_Aggregates - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Aggregates); - } - } - - public static string SchemaHierarchy_ServerRoles - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ServerRoles); - } - } - - public static string SchemaHierarchy_ApplicationRoles - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ApplicationRoles); - } - } - - public static string SchemaHierarchy_Assemblies - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Assemblies); - } - } - - public static string SchemaHierarchy_AssemblyFiles - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_AssemblyFiles); - } - } - - public static string SchemaHierarchy_AsymmetricKeys - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_AsymmetricKeys); - } - } - - public static string SchemaHierarchy_DatabaseAsymmetricKeys - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_DatabaseAsymmetricKeys); - } - } - - public static string SchemaHierarchy_DataCompressionOptions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_DataCompressionOptions); - } - } - - public static string SchemaHierarchy_Certificates - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Certificates); - } - } - - public static string SchemaHierarchy_FileTables - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_FileTables); - } - } - - public static string SchemaHierarchy_DatabaseCertificates - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_DatabaseCertificates); - } - } - - public static string SchemaHierarchy_CheckConstraints - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_CheckConstraints); - } - } - - public static string SchemaHierarchy_Columns - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Columns); - } - } - - public static string SchemaHierarchy_Constraints - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Constraints); - } - } - - public static string SchemaHierarchy_Contracts - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Contracts); - } - } - - public static string SchemaHierarchy_Credentials - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Credentials); - } - } - - public static string SchemaHierarchy_ErrorMessages - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ErrorMessages); - } - } - - public static string SchemaHierarchy_ServerRoleMembership - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ServerRoleMembership); - } - } - - public static string SchemaHierarchy_DatabaseOptions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_DatabaseOptions); - } - } - - public static string SchemaHierarchy_DatabaseRoles - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_DatabaseRoles); - } - } - - public static string SchemaHierarchy_RoleMemberships - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_RoleMemberships); - } - } - - public static string SchemaHierarchy_DatabaseTriggers - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_DatabaseTriggers); - } - } - - public static string SchemaHierarchy_DefaultConstraints - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_DefaultConstraints); - } - } - - public static string SchemaHierarchy_Defaults - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Defaults); - } - } - - public static string SchemaHierarchy_Sequences - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Sequences); - } - } - - public static string SchemaHierarchy_Endpoints - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Endpoints); - } - } - - public static string SchemaHierarchy_EventNotifications - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_EventNotifications); - } - } - - public static string SchemaHierarchy_ServerEventNotifications - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ServerEventNotifications); - } - } - - public static string SchemaHierarchy_ExtendedProperties - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ExtendedProperties); - } - } - - public static string SchemaHierarchy_FileGroups - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_FileGroups); - } - } - - public static string SchemaHierarchy_ForeignKeys - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ForeignKeys); - } - } - - public static string SchemaHierarchy_FullTextCatalogs - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_FullTextCatalogs); - } - } - - public static string SchemaHierarchy_FullTextIndexes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_FullTextIndexes); - } - } - - public static string SchemaHierarchy_Functions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Functions); - } - } - - public static string SchemaHierarchy_Indexes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Indexes); - } - } - - public static string SchemaHierarchy_InlineFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_InlineFunctions); - } - } - - public static string SchemaHierarchy_Keys - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Keys); - } - } - - public static string SchemaHierarchy_LinkedServers - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_LinkedServers); - } - } - - public static string SchemaHierarchy_Logins - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Logins); - } - } - - public static string SchemaHierarchy_MasterKey - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_MasterKey); - } - } - - public static string SchemaHierarchy_MasterKeys - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_MasterKeys); - } - } - - public static string SchemaHierarchy_MessageTypes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_MessageTypes); - } - } - - public static string SchemaHierarchy_MultiSelectFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_MultiSelectFunctions); - } - } - - public static string SchemaHierarchy_Parameters - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Parameters); - } - } - - public static string SchemaHierarchy_PartitionFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_PartitionFunctions); - } - } - - public static string SchemaHierarchy_PartitionSchemes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_PartitionSchemes); - } - } - - public static string SchemaHierarchy_Permissions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Permissions); - } - } - - public static string SchemaHierarchy_PrimaryKeys - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_PrimaryKeys); - } - } - - public static string SchemaHierarchy_Programmability - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Programmability); - } - } - - public static string SchemaHierarchy_Queues - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Queues); - } - } - - public static string SchemaHierarchy_RemoteServiceBindings - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_RemoteServiceBindings); - } - } - - public static string SchemaHierarchy_ReturnedColumns - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ReturnedColumns); - } - } - - public static string SchemaHierarchy_Roles - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Roles); - } - } - - public static string SchemaHierarchy_Routes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Routes); - } - } - - public static string SchemaHierarchy_Rules - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Rules); - } - } - - public static string SchemaHierarchy_Schemas - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Schemas); - } - } - - public static string SchemaHierarchy_BuiltInSchema - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_BuiltInSchema); - } - } - - public static string SchemaHierarchy_Security - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Security); - } - } - - public static string SchemaHierarchy_ServerObjects - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ServerObjects); - } - } - - public static string SchemaHierarchy_Management - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Management); - } - } - - public static string SchemaHierarchy_ServerTriggers - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ServerTriggers); - } - } - - public static string SchemaHierarchy_ServiceBroker - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ServiceBroker); - } - } - - public static string SchemaHierarchy_Services - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Services); - } - } - - public static string SchemaHierarchy_Signatures - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Signatures); - } - } - - public static string SchemaHierarchy_LogFiles - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_LogFiles); - } - } - - public static string SchemaHierarchy_Statistics - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Statistics); - } - } - - public static string SchemaHierarchy_Storage - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Storage); - } - } - - public static string SchemaHierarchy_StoredProcedures - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_StoredProcedures); - } - } - - public static string SchemaHierarchy_SymmetricKeys - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SymmetricKeys); - } - } - - public static string SchemaHierarchy_Synonyms - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Synonyms); - } - } - - public static string SchemaHierarchy_Tables - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Tables); - } - } - - public static string SchemaHierarchy_Triggers - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Triggers); - } - } - - public static string SchemaHierarchy_Types - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Types); - } - } - - public static string SchemaHierarchy_UniqueKeys - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_UniqueKeys); - } - } - - public static string SchemaHierarchy_UserDefinedDataTypes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_UserDefinedDataTypes); - } - } - - public static string SchemaHierarchy_UserDefinedTypes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_UserDefinedTypes); - } - } - - public static string SchemaHierarchy_Users - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Users); - } - } - - public static string SchemaHierarchy_Views - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Views); - } - } - - public static string SchemaHierarchy_XmlIndexes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_XmlIndexes); - } - } - - public static string SchemaHierarchy_XMLSchemaCollections - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_XMLSchemaCollections); - } - } - - public static string SchemaHierarchy_UserDefinedTableTypes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_UserDefinedTableTypes); - } - } - - public static string SchemaHierarchy_FilegroupFiles - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_FilegroupFiles); - } - } - - public static string MissingCaption - { - get - { - return Keys.GetString(Keys.MissingCaption); - } - } - - public static string SchemaHierarchy_BrokerPriorities - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_BrokerPriorities); - } - } - - public static string SchemaHierarchy_CryptographicProviders - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_CryptographicProviders); - } - } - - public static string SchemaHierarchy_DatabaseAuditSpecifications - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_DatabaseAuditSpecifications); - } - } - - public static string SchemaHierarchy_DatabaseEncryptionKeys - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_DatabaseEncryptionKeys); - } - } - - public static string SchemaHierarchy_EventSessions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_EventSessions); - } - } - - public static string SchemaHierarchy_FullTextStopLists - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_FullTextStopLists); - } - } - - public static string SchemaHierarchy_ResourcePools - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ResourcePools); - } - } - - public static string SchemaHierarchy_ServerAudits - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ServerAudits); - } - } - - public static string SchemaHierarchy_ServerAuditSpecifications - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ServerAuditSpecifications); - } - } - - public static string SchemaHierarchy_SpatialIndexes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SpatialIndexes); - } - } - - public static string SchemaHierarchy_WorkloadGroups - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_WorkloadGroups); - } - } - - public static string SchemaHierarchy_SqlFiles - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SqlFiles); - } - } - - public static string SchemaHierarchy_ServerFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ServerFunctions); - } - } - - public static string SchemaHierarchy_SqlType - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SqlType); - } - } - - public static string SchemaHierarchy_ServerOptions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ServerOptions); - } - } - - public static string SchemaHierarchy_DatabaseDiagrams - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_DatabaseDiagrams); - } - } - - public static string SchemaHierarchy_SystemTables - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemTables); - } - } - - public static string SchemaHierarchy_Databases - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Databases); - } - } - - public static string SchemaHierarchy_SystemContracts - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemContracts); - } - } - - public static string SchemaHierarchy_SystemDatabases - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemDatabases); - } - } - - public static string SchemaHierarchy_SystemMessageTypes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemMessageTypes); - } - } - - public static string SchemaHierarchy_SystemQueues - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemQueues); - } - } - - public static string SchemaHierarchy_SystemServices - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemServices); - } - } - - public static string SchemaHierarchy_SystemStoredProcedures - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemStoredProcedures); - } - } - - public static string SchemaHierarchy_SystemViews - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemViews); - } - } - - public static string SchemaHierarchy_DataTierApplications - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_DataTierApplications); - } - } - - public static string SchemaHierarchy_ExtendedStoredProcedures - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ExtendedStoredProcedures); - } - } - - public static string SchemaHierarchy_SystemAggregateFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemAggregateFunctions); - } - } - - public static string SchemaHierarchy_SystemApproximateNumerics - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemApproximateNumerics); - } - } - - public static string SchemaHierarchy_SystemBinaryStrings - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemBinaryStrings); - } - } - - public static string SchemaHierarchy_SystemCharacterStrings - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemCharacterStrings); - } - } - - public static string SchemaHierarchy_SystemCLRDataTypes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemCLRDataTypes); - } - } - - public static string SchemaHierarchy_SystemConfigurationFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemConfigurationFunctions); - } - } - - public static string SchemaHierarchy_SystemCursorFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemCursorFunctions); - } - } - - public static string SchemaHierarchy_SystemDataTypes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemDataTypes); - } - } - - public static string SchemaHierarchy_SystemDateAndTime - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemDateAndTime); - } - } - - public static string SchemaHierarchy_SystemDateAndTimeFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemDateAndTimeFunctions); - } - } - - public static string SchemaHierarchy_SystemExactNumerics - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemExactNumerics); - } - } - - public static string SchemaHierarchy_SystemFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemFunctions); - } - } - - public static string SchemaHierarchy_SystemHierarchyIdFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemHierarchyIdFunctions); - } - } - - public static string SchemaHierarchy_SystemMathematicalFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemMathematicalFunctions); - } - } - - public static string SchemaHierarchy_SystemMetadataFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemMetadataFunctions); - } - } - - public static string SchemaHierarchy_SystemOtherDataTypes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemOtherDataTypes); - } - } - - public static string SchemaHierarchy_SystemOtherFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemOtherFunctions); - } - } - - public static string SchemaHierarchy_SystemRowsetFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemRowsetFunctions); - } - } - - public static string SchemaHierarchy_SystemSecurityFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemSecurityFunctions); - } - } - - public static string SchemaHierarchy_SystemSpatialDataTypes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemSpatialDataTypes); - } - } - - public static string SchemaHierarchy_SystemStringFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemStringFunctions); - } - } - - public static string SchemaHierarchy_SystemSystemStatisticalFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemSystemStatisticalFunctions); - } - } - - public static string SchemaHierarchy_SystemTextAndImageFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemTextAndImageFunctions); - } - } - - public static string SchemaHierarchy_SystemUnicodeCharacterStrings - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemUnicodeCharacterStrings); - } - } - - public static string SchemaHierarchy_AggregateFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_AggregateFunctions); - } - } - - public static string SchemaHierarchy_ScalarValuedFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ScalarValuedFunctions); - } - } - - public static string SchemaHierarchy_TableValuedFunctions - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_TableValuedFunctions); - } - } - - public static string SchemaHierarchy_SystemExtendedStoredProcedures - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SystemExtendedStoredProcedures); - } - } - - public static string SchemaHierarchy_BuiltInType - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_BuiltInType); - } - } - - public static string SchemaHierarchy_BuiltInServerRole - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_BuiltInServerRole); - } - } - - public static string SchemaHierarchy_UserWithPassword - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_UserWithPassword); - } - } - - public static string SchemaHierarchy_SearchPropertyList - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SearchPropertyList); - } - } - - public static string SchemaHierarchy_SecurityPolicies - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SecurityPolicies); - } - } - - public static string SchemaHierarchy_SecurityPredicates - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SecurityPredicates); - } - } - - public static string SchemaHierarchy_ServerRole - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ServerRole); - } - } - - public static string SchemaHierarchy_SearchPropertyLists - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SearchPropertyLists); - } - } - - public static string SchemaHierarchy_ColumnStoreIndexes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ColumnStoreIndexes); - } - } - - public static string SchemaHierarchy_TableTypeIndexes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_TableTypeIndexes); - } - } - - public static string SchemaHierarchy_Server - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_Server); - } - } - - public static string SchemaHierarchy_SelectiveXmlIndexes - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SelectiveXmlIndexes); - } - } - - public static string SchemaHierarchy_XmlNamespaces - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_XmlNamespaces); - } - } - - public static string SchemaHierarchy_XmlTypedPromotedPaths - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_XmlTypedPromotedPaths); - } - } - - public static string SchemaHierarchy_SqlTypedPromotedPaths - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SqlTypedPromotedPaths); - } - } - - public static string SchemaHierarchy_DatabaseScopedCredentials - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_DatabaseScopedCredentials); - } - } - - public static string SchemaHierarchy_ExternalDataSources - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ExternalDataSources); - } - } - - public static string SchemaHierarchy_ExternalFileFormats - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ExternalFileFormats); - } - } - - public static string SchemaHierarchy_ExternalResources - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ExternalResources); - } - } - - public static string SchemaHierarchy_ExternalTables - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ExternalTables); - } - } - - public static string SchemaHierarchy_DroppedLedgerColumns - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_DroppedLedgerColumns); - } - } - - public static string SchemaHierarchy_DroppedLedgerTables - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_DroppedLedgerTables); - } - } - - public static string SchemaHierarchy_DroppedLedgerViews - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_DroppedLedgerViews); - } - } - - public static string SchemaHierarchy_AlwaysEncryptedKeys - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_AlwaysEncryptedKeys); - } - } - - public static string SchemaHierarchy_ColumnMasterKeys - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ColumnMasterKeys); - } - } - - public static string SchemaHierarchy_ColumnEncryptionKeys - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ColumnEncryptionKeys); - } - } - - public static string SchemaHierarchy_SubroutineParameterLabelFormatString - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SubroutineParameterLabelFormatString); - } - } - - public static string SchemaHierarchy_SubroutineParameterNoDefaultLabel - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SubroutineParameterNoDefaultLabel); - } - } - - public static string SchemaHierarchy_SubroutineParameterInputLabel - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SubroutineParameterInputLabel); - } - } - - public static string SchemaHierarchy_SubroutineParameterInputOutputLabel - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SubroutineParameterInputOutputLabel); - } - } - - public static string SchemaHierarchy_SubroutineParameterInputReadOnlyLabel - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SubroutineParameterInputReadOnlyLabel); - } - } - - public static string SchemaHierarchy_SubroutineParameterInputOutputReadOnlyLabel - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SubroutineParameterInputOutputReadOnlyLabel); - } - } - - public static string SchemaHierarchy_SubroutineParameterDefaultLabel - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_SubroutineParameterDefaultLabel); - } - } - - public static string SchemaHierarchy_NullColumn_Label - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_NullColumn_Label); - } - } - - public static string SchemaHierarchy_NotNullColumn_Label - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_NotNullColumn_Label); - } - } - - public static string SchemaHierarchy_UDDTLabelWithType - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_UDDTLabelWithType); - } - } - - public static string SchemaHierarchy_UDDTLabelWithoutType - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_UDDTLabelWithoutType); - } - } - - public static string SchemaHierarchy_ComputedColumnLabelWithType - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ComputedColumnLabelWithType); - } - } - - public static string SchemaHierarchy_ComputedColumnLabelWithoutType - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ComputedColumnLabelWithoutType); - } - } - - public static string SchemaHierarchy_ColumnSetLabelWithoutType - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ColumnSetLabelWithoutType); - } - } - - public static string SchemaHierarchy_ColumnSetLabelWithType - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ColumnSetLabelWithType); - } - } - - public static string SchemaHierarchy_ColumnSetLabelWithTypeAndKeyString - { - get - { - return Keys.GetString(Keys.SchemaHierarchy_ColumnSetLabelWithTypeAndKeyString); - } - } - - public static string UniqueIndex_LabelPart - { - get - { - return Keys.GetString(Keys.UniqueIndex_LabelPart); - } - } - - public static string NonUniqueIndex_LabelPart - { - get - { - return Keys.GetString(Keys.NonUniqueIndex_LabelPart); - } - } - - public static string ClusteredIndex_LabelPart - { - get - { - return Keys.GetString(Keys.ClusteredIndex_LabelPart); - } - } - - public static string NonClusteredIndex_LabelPart - { - get - { - return Keys.GetString(Keys.NonClusteredIndex_LabelPart); - } - } - - public static string History_LabelPart - { - get - { - return Keys.GetString(Keys.History_LabelPart); - } - } - - public static string SystemVersioned_LabelPart - { - get - { - return Keys.GetString(Keys.SystemVersioned_LabelPart); - } - } - - public static string UpdatableLedger_LabelPart - { - get - { - return Keys.GetString(Keys.UpdatableLedger_LabelPart); - } - } - - public static string AppendOnlyLedger_LabelPart - { - get - { - return Keys.GetString(Keys.AppendOnlyLedger_LabelPart); - } - } - - public static string Ledger_LabelPart - { - get - { - return Keys.GetString(Keys.Ledger_LabelPart); - } - } - - public static string External_LabelPart - { - get - { - return Keys.GetString(Keys.External_LabelPart); - } - } - - public static string FileTable_LabelPart - { - get - { - return Keys.GetString(Keys.FileTable_LabelPart); - } - } - - public static string DatabaseNotAccessible - { - get - { - return Keys.GetString(Keys.DatabaseNotAccessible); - } - } - - public static string FilterName - { - get - { - return Keys.GetString(Keys.FilterName); - } - } - - public static string FilterNameDescription - { - get - { - return Keys.GetString(Keys.FilterNameDescription); - } - } - - public static string FilterSchema - { - get - { - return Keys.GetString(Keys.FilterSchema); - } - } - - public static string FilterSchemaDescription - { - get - { - return Keys.GetString(Keys.FilterSchemaDescription); - } - } - - public static string FilterOwner - { - get - { - return Keys.GetString(Keys.FilterOwner); - } - } - - public static string FilterOwnerDescription - { - get - { - return Keys.GetString(Keys.FilterOwnerDescription); - } - } - - public static string FilterDurabilityType - { - get - { - return Keys.GetString(Keys.FilterDurabilityType); - } - } - - public static string FilterDurabilityTypeDescription - { - get - { - return Keys.GetString(Keys.FilterDurabilityTypeDescription); - } - } - - public static string FilterDurabilitySchemaOnly - { - get - { - return Keys.GetString(Keys.FilterDurabilitySchemaOnly); - } - } - - public static string FilterDurabilitySchemaAndData - { - get - { - return Keys.GetString(Keys.FilterDurabilitySchemaAndData); - } - } - - public static string FilterIsMemoryOptimized - { - get - { - return Keys.GetString(Keys.FilterIsMemoryOptimized); - } - } - - public static string FilterIsMemoryOptimizedDescription - { - get - { - return Keys.GetString(Keys.FilterIsMemoryOptimizedDescription); - } - } - - public static string FilterCreateDate - { - get - { - return Keys.GetString(Keys.FilterCreateDate); - } - } - - public static string FilterCreateDateDescription - { - get - { - return Keys.GetString(Keys.FilterCreateDateDescription); - } - } - - public static string FilterIsNativelyCompiled - { - get - { - return Keys.GetString(Keys.FilterIsNativelyCompiled); - } - } - - public static string FilterIsNativelyCompiledDescription - { - get - { - return Keys.GetString(Keys.FilterIsNativelyCompiledDescription); - } - } - - public static string FilterInPrimaryKey - { - get - { - return Keys.GetString(Keys.FilterInPrimaryKey); - } - } - - public static string FilterInPrimaryKeyDescription - { - get - { - return Keys.GetString(Keys.FilterInPrimaryKeyDescription); - } - } - public static string ScriptingParams_ConnectionString_Property_Invalid { get @@ -13347,642 +11651,6 @@ namespace Microsoft.SqlTools.ServiceLayer public const string SqlScriptFormatterScalarTypeMissingScale = "SqlScriptFormatterScalarTypeMissingScale"; - public const string TreeNodeError = "TreeNodeError"; - - - public const string ServerNodeConnectionError = "ServerNodeConnectionError"; - - - public const string SchemaHierarchy_Aggregates = "SchemaHierarchy_Aggregates"; - - - public const string SchemaHierarchy_ServerRoles = "SchemaHierarchy_ServerRoles"; - - - public const string SchemaHierarchy_ApplicationRoles = "SchemaHierarchy_ApplicationRoles"; - - - public const string SchemaHierarchy_Assemblies = "SchemaHierarchy_Assemblies"; - - - public const string SchemaHierarchy_AssemblyFiles = "SchemaHierarchy_AssemblyFiles"; - - - public const string SchemaHierarchy_AsymmetricKeys = "SchemaHierarchy_AsymmetricKeys"; - - - public const string SchemaHierarchy_DatabaseAsymmetricKeys = "SchemaHierarchy_DatabaseAsymmetricKeys"; - - - public const string SchemaHierarchy_DataCompressionOptions = "SchemaHierarchy_DataCompressionOptions"; - - - public const string SchemaHierarchy_Certificates = "SchemaHierarchy_Certificates"; - - - public const string SchemaHierarchy_FileTables = "SchemaHierarchy_FileTables"; - - - public const string SchemaHierarchy_DatabaseCertificates = "SchemaHierarchy_DatabaseCertificates"; - - - public const string SchemaHierarchy_CheckConstraints = "SchemaHierarchy_CheckConstraints"; - - - public const string SchemaHierarchy_Columns = "SchemaHierarchy_Columns"; - - - public const string SchemaHierarchy_Constraints = "SchemaHierarchy_Constraints"; - - - public const string SchemaHierarchy_Contracts = "SchemaHierarchy_Contracts"; - - - public const string SchemaHierarchy_Credentials = "SchemaHierarchy_Credentials"; - - - public const string SchemaHierarchy_ErrorMessages = "SchemaHierarchy_ErrorMessages"; - - - public const string SchemaHierarchy_ServerRoleMembership = "SchemaHierarchy_ServerRoleMembership"; - - - public const string SchemaHierarchy_DatabaseOptions = "SchemaHierarchy_DatabaseOptions"; - - - public const string SchemaHierarchy_DatabaseRoles = "SchemaHierarchy_DatabaseRoles"; - - - public const string SchemaHierarchy_RoleMemberships = "SchemaHierarchy_RoleMemberships"; - - - public const string SchemaHierarchy_DatabaseTriggers = "SchemaHierarchy_DatabaseTriggers"; - - - public const string SchemaHierarchy_DefaultConstraints = "SchemaHierarchy_DefaultConstraints"; - - - public const string SchemaHierarchy_Defaults = "SchemaHierarchy_Defaults"; - - - public const string SchemaHierarchy_Sequences = "SchemaHierarchy_Sequences"; - - - public const string SchemaHierarchy_Endpoints = "SchemaHierarchy_Endpoints"; - - - public const string SchemaHierarchy_EventNotifications = "SchemaHierarchy_EventNotifications"; - - - public const string SchemaHierarchy_ServerEventNotifications = "SchemaHierarchy_ServerEventNotifications"; - - - public const string SchemaHierarchy_ExtendedProperties = "SchemaHierarchy_ExtendedProperties"; - - - public const string SchemaHierarchy_FileGroups = "SchemaHierarchy_FileGroups"; - - - public const string SchemaHierarchy_ForeignKeys = "SchemaHierarchy_ForeignKeys"; - - - public const string SchemaHierarchy_FullTextCatalogs = "SchemaHierarchy_FullTextCatalogs"; - - - public const string SchemaHierarchy_FullTextIndexes = "SchemaHierarchy_FullTextIndexes"; - - - public const string SchemaHierarchy_Functions = "SchemaHierarchy_Functions"; - - - public const string SchemaHierarchy_Indexes = "SchemaHierarchy_Indexes"; - - - public const string SchemaHierarchy_InlineFunctions = "SchemaHierarchy_InlineFunctions"; - - - public const string SchemaHierarchy_Keys = "SchemaHierarchy_Keys"; - - - public const string SchemaHierarchy_LinkedServers = "SchemaHierarchy_LinkedServers"; - - - public const string SchemaHierarchy_Logins = "SchemaHierarchy_Logins"; - - - public const string SchemaHierarchy_MasterKey = "SchemaHierarchy_MasterKey"; - - - public const string SchemaHierarchy_MasterKeys = "SchemaHierarchy_MasterKeys"; - - - public const string SchemaHierarchy_MessageTypes = "SchemaHierarchy_MessageTypes"; - - - public const string SchemaHierarchy_MultiSelectFunctions = "SchemaHierarchy_MultiSelectFunctions"; - - - public const string SchemaHierarchy_Parameters = "SchemaHierarchy_Parameters"; - - - public const string SchemaHierarchy_PartitionFunctions = "SchemaHierarchy_PartitionFunctions"; - - - public const string SchemaHierarchy_PartitionSchemes = "SchemaHierarchy_PartitionSchemes"; - - - public const string SchemaHierarchy_Permissions = "SchemaHierarchy_Permissions"; - - - public const string SchemaHierarchy_PrimaryKeys = "SchemaHierarchy_PrimaryKeys"; - - - public const string SchemaHierarchy_Programmability = "SchemaHierarchy_Programmability"; - - - public const string SchemaHierarchy_Queues = "SchemaHierarchy_Queues"; - - - public const string SchemaHierarchy_RemoteServiceBindings = "SchemaHierarchy_RemoteServiceBindings"; - - - public const string SchemaHierarchy_ReturnedColumns = "SchemaHierarchy_ReturnedColumns"; - - - public const string SchemaHierarchy_Roles = "SchemaHierarchy_Roles"; - - - public const string SchemaHierarchy_Routes = "SchemaHierarchy_Routes"; - - - public const string SchemaHierarchy_Rules = "SchemaHierarchy_Rules"; - - - public const string SchemaHierarchy_Schemas = "SchemaHierarchy_Schemas"; - - - public const string SchemaHierarchy_BuiltInSchema = "SchemaHierarchy_BuiltInSchema"; - - - public const string SchemaHierarchy_Security = "SchemaHierarchy_Security"; - - - public const string SchemaHierarchy_ServerObjects = "SchemaHierarchy_ServerObjects"; - - - public const string SchemaHierarchy_Management = "SchemaHierarchy_Management"; - - - public const string SchemaHierarchy_ServerTriggers = "SchemaHierarchy_ServerTriggers"; - - - public const string SchemaHierarchy_ServiceBroker = "SchemaHierarchy_ServiceBroker"; - - - public const string SchemaHierarchy_Services = "SchemaHierarchy_Services"; - - - public const string SchemaHierarchy_Signatures = "SchemaHierarchy_Signatures"; - - - public const string SchemaHierarchy_LogFiles = "SchemaHierarchy_LogFiles"; - - - public const string SchemaHierarchy_Statistics = "SchemaHierarchy_Statistics"; - - - public const string SchemaHierarchy_Storage = "SchemaHierarchy_Storage"; - - - public const string SchemaHierarchy_StoredProcedures = "SchemaHierarchy_StoredProcedures"; - - - public const string SchemaHierarchy_SymmetricKeys = "SchemaHierarchy_SymmetricKeys"; - - - public const string SchemaHierarchy_Synonyms = "SchemaHierarchy_Synonyms"; - - - public const string SchemaHierarchy_Tables = "SchemaHierarchy_Tables"; - - - public const string SchemaHierarchy_Triggers = "SchemaHierarchy_Triggers"; - - - public const string SchemaHierarchy_Types = "SchemaHierarchy_Types"; - - - public const string SchemaHierarchy_UniqueKeys = "SchemaHierarchy_UniqueKeys"; - - - public const string SchemaHierarchy_UserDefinedDataTypes = "SchemaHierarchy_UserDefinedDataTypes"; - - - public const string SchemaHierarchy_UserDefinedTypes = "SchemaHierarchy_UserDefinedTypes"; - - - public const string SchemaHierarchy_Users = "SchemaHierarchy_Users"; - - - public const string SchemaHierarchy_Views = "SchemaHierarchy_Views"; - - - public const string SchemaHierarchy_XmlIndexes = "SchemaHierarchy_XmlIndexes"; - - - public const string SchemaHierarchy_XMLSchemaCollections = "SchemaHierarchy_XMLSchemaCollections"; - - - public const string SchemaHierarchy_UserDefinedTableTypes = "SchemaHierarchy_UserDefinedTableTypes"; - - - public const string SchemaHierarchy_FilegroupFiles = "SchemaHierarchy_FilegroupFiles"; - - - public const string MissingCaption = "MissingCaption"; - - - public const string SchemaHierarchy_BrokerPriorities = "SchemaHierarchy_BrokerPriorities"; - - - public const string SchemaHierarchy_CryptographicProviders = "SchemaHierarchy_CryptographicProviders"; - - - public const string SchemaHierarchy_DatabaseAuditSpecifications = "SchemaHierarchy_DatabaseAuditSpecifications"; - - - public const string SchemaHierarchy_DatabaseEncryptionKeys = "SchemaHierarchy_DatabaseEncryptionKeys"; - - - public const string SchemaHierarchy_EventSessions = "SchemaHierarchy_EventSessions"; - - - public const string SchemaHierarchy_FullTextStopLists = "SchemaHierarchy_FullTextStopLists"; - - - public const string SchemaHierarchy_ResourcePools = "SchemaHierarchy_ResourcePools"; - - - public const string SchemaHierarchy_ServerAudits = "SchemaHierarchy_ServerAudits"; - - - public const string SchemaHierarchy_ServerAuditSpecifications = "SchemaHierarchy_ServerAuditSpecifications"; - - - public const string SchemaHierarchy_SpatialIndexes = "SchemaHierarchy_SpatialIndexes"; - - - public const string SchemaHierarchy_WorkloadGroups = "SchemaHierarchy_WorkloadGroups"; - - - public const string SchemaHierarchy_SqlFiles = "SchemaHierarchy_SqlFiles"; - - - public const string SchemaHierarchy_ServerFunctions = "SchemaHierarchy_ServerFunctions"; - - - public const string SchemaHierarchy_SqlType = "SchemaHierarchy_SqlType"; - - - public const string SchemaHierarchy_ServerOptions = "SchemaHierarchy_ServerOptions"; - - - public const string SchemaHierarchy_DatabaseDiagrams = "SchemaHierarchy_DatabaseDiagrams"; - - - public const string SchemaHierarchy_SystemTables = "SchemaHierarchy_SystemTables"; - - - public const string SchemaHierarchy_Databases = "SchemaHierarchy_Databases"; - - - public const string SchemaHierarchy_SystemContracts = "SchemaHierarchy_SystemContracts"; - - - public const string SchemaHierarchy_SystemDatabases = "SchemaHierarchy_SystemDatabases"; - - - public const string SchemaHierarchy_SystemMessageTypes = "SchemaHierarchy_SystemMessageTypes"; - - - public const string SchemaHierarchy_SystemQueues = "SchemaHierarchy_SystemQueues"; - - - public const string SchemaHierarchy_SystemServices = "SchemaHierarchy_SystemServices"; - - - public const string SchemaHierarchy_SystemStoredProcedures = "SchemaHierarchy_SystemStoredProcedures"; - - - public const string SchemaHierarchy_SystemViews = "SchemaHierarchy_SystemViews"; - - - public const string SchemaHierarchy_DataTierApplications = "SchemaHierarchy_DataTierApplications"; - - - public const string SchemaHierarchy_ExtendedStoredProcedures = "SchemaHierarchy_ExtendedStoredProcedures"; - - - public const string SchemaHierarchy_SystemAggregateFunctions = "SchemaHierarchy_SystemAggregateFunctions"; - - - public const string SchemaHierarchy_SystemApproximateNumerics = "SchemaHierarchy_SystemApproximateNumerics"; - - - public const string SchemaHierarchy_SystemBinaryStrings = "SchemaHierarchy_SystemBinaryStrings"; - - - public const string SchemaHierarchy_SystemCharacterStrings = "SchemaHierarchy_SystemCharacterStrings"; - - - public const string SchemaHierarchy_SystemCLRDataTypes = "SchemaHierarchy_SystemCLRDataTypes"; - - - public const string SchemaHierarchy_SystemConfigurationFunctions = "SchemaHierarchy_SystemConfigurationFunctions"; - - - public const string SchemaHierarchy_SystemCursorFunctions = "SchemaHierarchy_SystemCursorFunctions"; - - - public const string SchemaHierarchy_SystemDataTypes = "SchemaHierarchy_SystemDataTypes"; - - - public const string SchemaHierarchy_SystemDateAndTime = "SchemaHierarchy_SystemDateAndTime"; - - - public const string SchemaHierarchy_SystemDateAndTimeFunctions = "SchemaHierarchy_SystemDateAndTimeFunctions"; - - - public const string SchemaHierarchy_SystemExactNumerics = "SchemaHierarchy_SystemExactNumerics"; - - - public const string SchemaHierarchy_SystemFunctions = "SchemaHierarchy_SystemFunctions"; - - - public const string SchemaHierarchy_SystemHierarchyIdFunctions = "SchemaHierarchy_SystemHierarchyIdFunctions"; - - - public const string SchemaHierarchy_SystemMathematicalFunctions = "SchemaHierarchy_SystemMathematicalFunctions"; - - - public const string SchemaHierarchy_SystemMetadataFunctions = "SchemaHierarchy_SystemMetadataFunctions"; - - - public const string SchemaHierarchy_SystemOtherDataTypes = "SchemaHierarchy_SystemOtherDataTypes"; - - - public const string SchemaHierarchy_SystemOtherFunctions = "SchemaHierarchy_SystemOtherFunctions"; - - - public const string SchemaHierarchy_SystemRowsetFunctions = "SchemaHierarchy_SystemRowsetFunctions"; - - - public const string SchemaHierarchy_SystemSecurityFunctions = "SchemaHierarchy_SystemSecurityFunctions"; - - - public const string SchemaHierarchy_SystemSpatialDataTypes = "SchemaHierarchy_SystemSpatialDataTypes"; - - - public const string SchemaHierarchy_SystemStringFunctions = "SchemaHierarchy_SystemStringFunctions"; - - - public const string SchemaHierarchy_SystemSystemStatisticalFunctions = "SchemaHierarchy_SystemSystemStatisticalFunctions"; - - - public const string SchemaHierarchy_SystemTextAndImageFunctions = "SchemaHierarchy_SystemTextAndImageFunctions"; - - - public const string SchemaHierarchy_SystemUnicodeCharacterStrings = "SchemaHierarchy_SystemUnicodeCharacterStrings"; - - - public const string SchemaHierarchy_AggregateFunctions = "SchemaHierarchy_AggregateFunctions"; - - - public const string SchemaHierarchy_ScalarValuedFunctions = "SchemaHierarchy_ScalarValuedFunctions"; - - - public const string SchemaHierarchy_TableValuedFunctions = "SchemaHierarchy_TableValuedFunctions"; - - - public const string SchemaHierarchy_SystemExtendedStoredProcedures = "SchemaHierarchy_SystemExtendedStoredProcedures"; - - - public const string SchemaHierarchy_BuiltInType = "SchemaHierarchy_BuiltInType"; - - - public const string SchemaHierarchy_BuiltInServerRole = "SchemaHierarchy_BuiltInServerRole"; - - - public const string SchemaHierarchy_UserWithPassword = "SchemaHierarchy_UserWithPassword"; - - - public const string SchemaHierarchy_SearchPropertyList = "SchemaHierarchy_SearchPropertyList"; - - - public const string SchemaHierarchy_SecurityPolicies = "SchemaHierarchy_SecurityPolicies"; - - - public const string SchemaHierarchy_SecurityPredicates = "SchemaHierarchy_SecurityPredicates"; - - - public const string SchemaHierarchy_ServerRole = "SchemaHierarchy_ServerRole"; - - - public const string SchemaHierarchy_SearchPropertyLists = "SchemaHierarchy_SearchPropertyLists"; - - - public const string SchemaHierarchy_ColumnStoreIndexes = "SchemaHierarchy_ColumnStoreIndexes"; - - - public const string SchemaHierarchy_TableTypeIndexes = "SchemaHierarchy_TableTypeIndexes"; - - - public const string SchemaHierarchy_Server = "SchemaHierarchy_Server"; - - - public const string SchemaHierarchy_SelectiveXmlIndexes = "SchemaHierarchy_SelectiveXmlIndexes"; - - - public const string SchemaHierarchy_XmlNamespaces = "SchemaHierarchy_XmlNamespaces"; - - - public const string SchemaHierarchy_XmlTypedPromotedPaths = "SchemaHierarchy_XmlTypedPromotedPaths"; - - - public const string SchemaHierarchy_SqlTypedPromotedPaths = "SchemaHierarchy_SqlTypedPromotedPaths"; - - - public const string SchemaHierarchy_DatabaseScopedCredentials = "SchemaHierarchy_DatabaseScopedCredentials"; - - - public const string SchemaHierarchy_ExternalDataSources = "SchemaHierarchy_ExternalDataSources"; - - - public const string SchemaHierarchy_ExternalFileFormats = "SchemaHierarchy_ExternalFileFormats"; - - - public const string SchemaHierarchy_ExternalResources = "SchemaHierarchy_ExternalResources"; - - - public const string SchemaHierarchy_ExternalTables = "SchemaHierarchy_ExternalTables"; - - - public const string SchemaHierarchy_DroppedLedgerColumns = "SchemaHierarchy_DroppedLedgerColumns"; - - - public const string SchemaHierarchy_DroppedLedgerTables = "SchemaHierarchy_DroppedLedgerTables"; - - - public const string SchemaHierarchy_DroppedLedgerViews = "SchemaHierarchy_DroppedLedgerViews"; - - - public const string SchemaHierarchy_AlwaysEncryptedKeys = "SchemaHierarchy_AlwaysEncryptedKeys"; - - - public const string SchemaHierarchy_ColumnMasterKeys = "SchemaHierarchy_ColumnMasterKeys"; - - - public const string SchemaHierarchy_ColumnEncryptionKeys = "SchemaHierarchy_ColumnEncryptionKeys"; - - - public const string SchemaHierarchy_SubroutineParameterLabelFormatString = "SchemaHierarchy_SubroutineParameterLabelFormatString"; - - - public const string SchemaHierarchy_SubroutineParameterNoDefaultLabel = "SchemaHierarchy_SubroutineParameterNoDefaultLabel"; - - - public const string SchemaHierarchy_SubroutineParameterInputLabel = "SchemaHierarchy_SubroutineParameterInputLabel"; - - - public const string SchemaHierarchy_SubroutineParameterInputOutputLabel = "SchemaHierarchy_SubroutineParameterInputOutputLabel"; - - - public const string SchemaHierarchy_SubroutineParameterInputReadOnlyLabel = "SchemaHierarchy_SubroutineParameterInputReadOnlyLabel"; - - - public const string SchemaHierarchy_SubroutineParameterInputOutputReadOnlyLabel = "SchemaHierarchy_SubroutineParameterInputOutputReadOnlyLabel"; - - - public const string SchemaHierarchy_SubroutineParameterDefaultLabel = "SchemaHierarchy_SubroutineParameterDefaultLabel"; - - - public const string SchemaHierarchy_NullColumn_Label = "SchemaHierarchy_NullColumn_Label"; - - - public const string SchemaHierarchy_NotNullColumn_Label = "SchemaHierarchy_NotNullColumn_Label"; - - - public const string SchemaHierarchy_UDDTLabelWithType = "SchemaHierarchy_UDDTLabelWithType"; - - - public const string SchemaHierarchy_UDDTLabelWithoutType = "SchemaHierarchy_UDDTLabelWithoutType"; - - - public const string SchemaHierarchy_ComputedColumnLabelWithType = "SchemaHierarchy_ComputedColumnLabelWithType"; - - - public const string SchemaHierarchy_ComputedColumnLabelWithoutType = "SchemaHierarchy_ComputedColumnLabelWithoutType"; - - - public const string SchemaHierarchy_ColumnSetLabelWithoutType = "SchemaHierarchy_ColumnSetLabelWithoutType"; - - - public const string SchemaHierarchy_ColumnSetLabelWithType = "SchemaHierarchy_ColumnSetLabelWithType"; - - - public const string SchemaHierarchy_ColumnSetLabelWithTypeAndKeyString = "SchemaHierarchy_ColumnSetLabelWithTypeAndKeyString"; - - - public const string UniqueIndex_LabelPart = "UniqueIndex_LabelPart"; - - - public const string NonUniqueIndex_LabelPart = "NonUniqueIndex_LabelPart"; - - - public const string ClusteredIndex_LabelPart = "ClusteredIndex_LabelPart"; - - - public const string NonClusteredIndex_LabelPart = "NonClusteredIndex_LabelPart"; - - - public const string History_LabelPart = "History_LabelPart"; - - - public const string SystemVersioned_LabelPart = "SystemVersioned_LabelPart"; - - - public const string UpdatableLedger_LabelPart = "UpdatableLedger_LabelPart"; - - - public const string AppendOnlyLedger_LabelPart = "AppendOnlyLedger_LabelPart"; - - - public const string Ledger_LabelPart = "Ledger_LabelPart"; - - - public const string External_LabelPart = "External_LabelPart"; - - - public const string FileTable_LabelPart = "FileTable_LabelPart"; - - - public const string DatabaseNotAccessible = "DatabaseNotAccessible"; - - - public const string FilterName = "FilterName"; - - - public const string FilterNameDescription = "FilterNameDescription"; - - - public const string FilterSchema = "FilterSchema"; - - - public const string FilterSchemaDescription = "FilterSchemaDescription"; - - - public const string FilterOwner = "FilterOwner"; - - - public const string FilterOwnerDescription = "FilterOwnerDescription"; - - - public const string FilterDurabilityType = "FilterDurabilityType"; - - - public const string FilterDurabilityTypeDescription = "FilterDurabilityTypeDescription"; - - - public const string FilterDurabilitySchemaOnly = "FilterDurabilitySchemaOnly"; - - - public const string FilterDurabilitySchemaAndData = "FilterDurabilitySchemaAndData"; - - - public const string FilterIsMemoryOptimized = "FilterIsMemoryOptimized"; - - - public const string FilterIsMemoryOptimizedDescription = "FilterIsMemoryOptimizedDescription"; - - - public const string FilterCreateDate = "FilterCreateDate"; - - - public const string FilterCreateDateDescription = "FilterCreateDateDescription"; - - - public const string FilterIsNativelyCompiled = "FilterIsNativelyCompiled"; - - - public const string FilterIsNativelyCompiledDescription = "FilterIsNativelyCompiledDescription"; - - - public const string FilterInPrimaryKey = "FilterInPrimaryKey"; - - - public const string FilterInPrimaryKeyDescription = "FilterInPrimaryKeyDescription"; - - public const string ScriptingParams_ConnectionString_Property_Invalid = "ScriptingParams_ConnectionString_Property_Invalid"; diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx index c9dcdaa9..9728be04 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx @@ -678,854 +678,6 @@ Scalar column missing scale - - Error expanding: {0} - - - - Error connecting to {0} - - - - Aggregates - - - - Server Roles - - - - Application Roles - - - - Assemblies - - - - Assembly Files - - - - Asymmetric Keys - - - - Asymmetric Keys - - - - Data Compression Options - - - - Certificates - - - - FileTables - - - - Certificates - - - - Check Constraints - - - - Columns - - - - Constraints - - - - Contracts - - - - Credentials - - - - Error Messages - - - - Server Role Membership - - - - Database Options - - - - Database Roles - - - - Role Memberships - - - - Database Triggers - - - - Default Constraints - - - - Defaults - - - - Sequences - - - - Endpoints - - - - Event Notifications - - - - Server Event Notifications - - - - Extended Properties - - - - Filegroups - - - - Foreign Keys - - - - Full-Text Catalogs - - - - Full-Text Indexes - - - - Functions - - - - Indexes - - - - Inline Functions - - - - Keys - - - - Linked Servers - - - - Logins - - - - Master Key - - - - Master Keys - - - - Message Types - - - - Table-Valued Functions - - - - Parameters - - - - Partition Functions - - - - Partition Schemes - - - - Permissions - - - - Primary Keys - - - - Programmability - - - - Queues - - - - Remote Service Bindings - - - - Returned Columns - - - - Roles - - - - Routes - - - - Rules - - - - Schemas - - - - Built-in Schemas - - - - Security - - - - Server Objects - - - - Management - - - - Triggers - - - - Service Broker - - - - Services - - - - Signatures - - - - Log Files - - - - Statistics - - - - Storage - - - - Stored Procedures - - - - Symmetric Keys - - - - Synonyms - - - - Tables - - - - Triggers - - - - Types - - - - Unique Keys - - - - User-Defined Data Types - - - - User-Defined Types (CLR) - - - - Users - - - - Views - - - - XML Indexes - - - - XML Schema Collections - - - - User-Defined Table Types - - - - Files - - - - Missing Caption - - - - Broker Priorities - - - - Cryptographic Providers - - - - Database Audit Specifications - - - - Database Encryption Keys - - - - Event Sessions - - - - Full Text Stoplists - - - - Resource Pools - - - - Audits - - - - Server Audit Specifications - - - - Spatial Indexes - - - - Workload Groups - - - - SQL Files - - - - Server Functions - - - - SQL Type - - - - Server Options - - - - Database Diagrams - - - - System Tables - - - - Databases - - - - System Contracts - - - - System Databases - - - - System Message Types - - - - System Queues - - - - System Services - - - - System Stored Procedures - - - - System Views - - - - Data-tier Applications - - - - Extended Stored Procedures - - - - Aggregate Functions - - - - Approximate Numerics - - - - Binary Strings - - - - Character Strings - - - - CLR Data Types - - - - Configuration Functions - - - - Cursor Functions - - - - System Data Types - - - - Date and Time - - - - Date and Time Functions - - - - Exact Numerics - - - - System Functions - - - - Hierarchy Id Functions - - - - Mathematical Functions - - - - Metadata Functions - - - - Other Data Types - - - - Other Functions - - - - Rowset Functions - - - - Security Functions - - - - Spatial Data Types - - - - String Functions - - - - System Statistical Functions - - - - Text and Image Functions - - - - Unicode Character Strings - - - - Aggregate Functions - - - - Scalar-valued Functions - - - - Table-valued Functions - - - - System Extended Stored Procedures - - - - Built-in Types - - - - Built-in Server Roles - - - - User with Password - - - - Search Property List - - - - Security Policies - - - - Security Predicates - - - - Server Role - - - - Search Property Lists - - - - Column Store Indexes - - - - Table Type Indexes - - - - Server - - - - Selective XML Indexes - - - - XML Namespaces - - - - XML Typed Promoted Paths - - - - T-SQL Typed Promoted Paths - - - - Database Scoped Credentials - - - - External Data Sources - - - - External File Formats - - - - External Resources - - - - External Tables - - - - Dropped Ledger Columns - - - - Dropped Ledger Tables - - - - Dropped Ledger Views - - - - Always Encrypted Keys - - - - Column Master Keys - - - - Column Encryption Keys - - - - {0} ({1}, {2}, {3}) - - - - No default - - - - Input - - - - Input/Output - - - - Input/ReadOnly - - - - Input/Output/ReadOnly - - - - Default - - - - null - - - - not null - - - - {0} ({1}, {2}) - - - - {0} ({1}) - - - - {0} ({1}Computed, {2}, {3}) - - - - {0} ({1}Computed) - - - - {0} (Column Set, {1}) - - - - {0} (Column Set, {1}{2}, {3}) - - - - {0} (Column Set, {1}, {2}, {3}) - - - - Unique - - - - Non-Unique - - - - Clustered - - - - Non-Clustered - - - - History - - - - System-Versioned - - - - Updatable Ledger - - - - Append-Only Ledger - - - - Ledger - - - - External - - - - File Table - - - - The database {0} is not accessible. - - - - Name - - - - Include or exclude objects based on the name or part of a name. - - - - Schema - - - - Include or exclude objects based on the schema or part of a schema name. - - - - Owner - - - - Include or exclude objects based on the owner or part of an owner name. - - - - Durability Type - - - - Include or exclude objects based on the durability type. - - - - Schema Only - - - - Schema and Data - - - - Is Memory Optimized - - - - Include or exclude objects based on whether the object is memory optimized. - - - - Create Date - - - - Include or exclude objects based on their creation date. - - - - Is Natively Compiled - - - - Include or exclude objects based on whether the object is natively compiled. - - - - In Primary Key - - - - Include or exclude objects based on whether the column is in a primary key. - - Error parsing ScriptingParams.ConnectionString property. diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings index 4c937614..1d556f87 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings @@ -327,416 +327,6 @@ SqlScriptFormatterLengthTypeMissingSize = Column with length is missing size SqlScriptFormatterScalarTypeMissingScale = Scalar column missing scale -############################################################################ -# Object Explorer Service - -TreeNodeError = Error expanding: {0} - -ServerNodeConnectionError = Error connecting to {0} - -SchemaHierarchy_Aggregates = Aggregates - -SchemaHierarchy_ServerRoles = Server Roles - -SchemaHierarchy_ApplicationRoles = Application Roles - -SchemaHierarchy_Assemblies = Assemblies - -SchemaHierarchy_AssemblyFiles = Assembly Files - -SchemaHierarchy_AsymmetricKeys = Asymmetric Keys - -SchemaHierarchy_DatabaseAsymmetricKeys = Asymmetric Keys - -SchemaHierarchy_DataCompressionOptions = Data Compression Options - -SchemaHierarchy_Certificates = Certificates - -SchemaHierarchy_FileTables = FileTables - -SchemaHierarchy_DatabaseCertificates = Certificates - -SchemaHierarchy_CheckConstraints = Check Constraints - -SchemaHierarchy_Columns = Columns - -SchemaHierarchy_Constraints = Constraints - -SchemaHierarchy_Contracts = Contracts - -SchemaHierarchy_Credentials = Credentials - -SchemaHierarchy_ErrorMessages = Error Messages - -SchemaHierarchy_ServerRoleMembership = Server Role Membership - -SchemaHierarchy_DatabaseOptions = Database Options - -SchemaHierarchy_DatabaseRoles = Database Roles - -SchemaHierarchy_RoleMemberships = Role Memberships - -SchemaHierarchy_DatabaseTriggers = Database Triggers - -SchemaHierarchy_DefaultConstraints = Default Constraints - -SchemaHierarchy_Defaults = Defaults - -SchemaHierarchy_Sequences = Sequences - -SchemaHierarchy_Endpoints = Endpoints - -SchemaHierarchy_EventNotifications = Event Notifications - -SchemaHierarchy_ServerEventNotifications = Server Event Notifications - -SchemaHierarchy_ExtendedProperties = Extended Properties - -SchemaHierarchy_FileGroups = Filegroups - -SchemaHierarchy_ForeignKeys = Foreign Keys - -SchemaHierarchy_FullTextCatalogs = Full-Text Catalogs - -SchemaHierarchy_FullTextIndexes = Full-Text Indexes - -SchemaHierarchy_Functions = Functions - -SchemaHierarchy_Indexes = Indexes - -SchemaHierarchy_InlineFunctions = Inline Functions - -SchemaHierarchy_Keys = Keys - -SchemaHierarchy_LinkedServers = Linked Servers - -SchemaHierarchy_Logins = Logins - -SchemaHierarchy_MasterKey = Master Key - -SchemaHierarchy_MasterKeys = Master Keys - -SchemaHierarchy_MessageTypes = Message Types - -SchemaHierarchy_MultiSelectFunctions = Table-Valued Functions - -SchemaHierarchy_Parameters = Parameters - -SchemaHierarchy_PartitionFunctions = Partition Functions - -SchemaHierarchy_PartitionSchemes = Partition Schemes - -SchemaHierarchy_Permissions = Permissions - -SchemaHierarchy_PrimaryKeys = Primary Keys - -SchemaHierarchy_Programmability = Programmability - -SchemaHierarchy_Queues = Queues - -SchemaHierarchy_RemoteServiceBindings = Remote Service Bindings - -SchemaHierarchy_ReturnedColumns = Returned Columns - -SchemaHierarchy_Roles = Roles - -SchemaHierarchy_Routes = Routes - -SchemaHierarchy_Rules = Rules - -SchemaHierarchy_Schemas = Schemas - -SchemaHierarchy_BuiltInSchema = Built-in Schemas - -SchemaHierarchy_Security = Security - -SchemaHierarchy_ServerObjects = Server Objects - -SchemaHierarchy_Management = Management - -SchemaHierarchy_ServerTriggers = Triggers - -SchemaHierarchy_ServiceBroker = Service Broker - -SchemaHierarchy_Services = Services - -SchemaHierarchy_Signatures = Signatures - -SchemaHierarchy_LogFiles = Log Files - -SchemaHierarchy_Statistics = Statistics - -SchemaHierarchy_Storage = Storage - -SchemaHierarchy_StoredProcedures = Stored Procedures - -SchemaHierarchy_SymmetricKeys = Symmetric Keys - -SchemaHierarchy_Synonyms = Synonyms - -SchemaHierarchy_Tables = Tables - -SchemaHierarchy_Triggers = Triggers - -SchemaHierarchy_Types = Types - -SchemaHierarchy_UniqueKeys = Unique Keys - -SchemaHierarchy_UserDefinedDataTypes = User-Defined Data Types - -SchemaHierarchy_UserDefinedTypes = User-Defined Types (CLR) - -SchemaHierarchy_Users = Users - -SchemaHierarchy_Views = Views - -SchemaHierarchy_XmlIndexes = XML Indexes - -SchemaHierarchy_XMLSchemaCollections = XML Schema Collections - -SchemaHierarchy_UserDefinedTableTypes = User-Defined Table Types - -SchemaHierarchy_FilegroupFiles = Files - -MissingCaption = Missing Caption - -SchemaHierarchy_BrokerPriorities = Broker Priorities - -SchemaHierarchy_CryptographicProviders = Cryptographic Providers - -SchemaHierarchy_DatabaseAuditSpecifications = Database Audit Specifications - -SchemaHierarchy_DatabaseEncryptionKeys = Database Encryption Keys - -SchemaHierarchy_EventSessions = Event Sessions - -SchemaHierarchy_FullTextStopLists = Full Text Stoplists - -SchemaHierarchy_ResourcePools = Resource Pools - -SchemaHierarchy_ServerAudits = Audits - -SchemaHierarchy_ServerAuditSpecifications = Server Audit Specifications - -SchemaHierarchy_SpatialIndexes = Spatial Indexes - -SchemaHierarchy_WorkloadGroups = Workload Groups - -SchemaHierarchy_SqlFiles = SQL Files - -SchemaHierarchy_ServerFunctions = Server Functions - -SchemaHierarchy_SqlType = SQL Type - -SchemaHierarchy_ServerOptions = Server Options - -SchemaHierarchy_DatabaseDiagrams = Database Diagrams - -SchemaHierarchy_SystemTables = System Tables - -SchemaHierarchy_Databases = Databases - -SchemaHierarchy_SystemContracts = System Contracts - -SchemaHierarchy_SystemDatabases = System Databases - -SchemaHierarchy_SystemMessageTypes = System Message Types - -SchemaHierarchy_SystemQueues = System Queues - -SchemaHierarchy_SystemServices = System Services - -SchemaHierarchy_SystemStoredProcedures = System Stored Procedures - -SchemaHierarchy_SystemViews = System Views - -SchemaHierarchy_DataTierApplications = Data-tier Applications - -SchemaHierarchy_ExtendedStoredProcedures = Extended Stored Procedures - -SchemaHierarchy_SystemAggregateFunctions = Aggregate Functions - -SchemaHierarchy_SystemApproximateNumerics = Approximate Numerics - -SchemaHierarchy_SystemBinaryStrings = Binary Strings - -SchemaHierarchy_SystemCharacterStrings = Character Strings - -SchemaHierarchy_SystemCLRDataTypes = CLR Data Types - -SchemaHierarchy_SystemConfigurationFunctions = Configuration Functions - -SchemaHierarchy_SystemCursorFunctions = Cursor Functions - -SchemaHierarchy_SystemDataTypes = System Data Types - -SchemaHierarchy_SystemDateAndTime = Date and Time - -SchemaHierarchy_SystemDateAndTimeFunctions = Date and Time Functions - -SchemaHierarchy_SystemExactNumerics = Exact Numerics - -SchemaHierarchy_SystemFunctions = System Functions - -SchemaHierarchy_SystemHierarchyIdFunctions = Hierarchy Id Functions - -SchemaHierarchy_SystemMathematicalFunctions = Mathematical Functions - -SchemaHierarchy_SystemMetadataFunctions = Metadata Functions - -SchemaHierarchy_SystemOtherDataTypes = Other Data Types - -SchemaHierarchy_SystemOtherFunctions = Other Functions - -SchemaHierarchy_SystemRowsetFunctions = Rowset Functions - -SchemaHierarchy_SystemSecurityFunctions = Security Functions - -SchemaHierarchy_SystemSpatialDataTypes = Spatial Data Types - -SchemaHierarchy_SystemStringFunctions = String Functions - -SchemaHierarchy_SystemSystemStatisticalFunctions = System Statistical Functions - -SchemaHierarchy_SystemTextAndImageFunctions = Text and Image Functions - -SchemaHierarchy_SystemUnicodeCharacterStrings = Unicode Character Strings - -SchemaHierarchy_AggregateFunctions = Aggregate Functions - -SchemaHierarchy_ScalarValuedFunctions = Scalar-valued Functions - -SchemaHierarchy_TableValuedFunctions = Table-valued Functions - -SchemaHierarchy_SystemExtendedStoredProcedures = System Extended Stored Procedures - -SchemaHierarchy_BuiltInType = Built-in Types - -SchemaHierarchy_BuiltInServerRole = Built-in Server Roles - -SchemaHierarchy_UserWithPassword = User with Password - -SchemaHierarchy_SearchPropertyList = Search Property List - -SchemaHierarchy_SecurityPolicies = Security Policies - -SchemaHierarchy_SecurityPredicates = Security Predicates - -SchemaHierarchy_ServerRole = Server Role - -SchemaHierarchy_SearchPropertyLists = Search Property Lists - -SchemaHierarchy_ColumnStoreIndexes = Column Store Indexes - -SchemaHierarchy_TableTypeIndexes = Table Type Indexes - -SchemaHierarchy_Server = Server - -SchemaHierarchy_SelectiveXmlIndexes = Selective XML Indexes - -SchemaHierarchy_XmlNamespaces = XML Namespaces - -SchemaHierarchy_XmlTypedPromotedPaths = XML Typed Promoted Paths - -SchemaHierarchy_SqlTypedPromotedPaths = T-SQL Typed Promoted Paths - -SchemaHierarchy_DatabaseScopedCredentials = Database Scoped Credentials - -SchemaHierarchy_ExternalDataSources = External Data Sources - -SchemaHierarchy_ExternalFileFormats = External File Formats - -SchemaHierarchy_ExternalResources = External Resources - -SchemaHierarchy_ExternalTables = External Tables - -SchemaHierarchy_DroppedLedgerColumns = Dropped Ledger Columns - -SchemaHierarchy_DroppedLedgerTables = Dropped Ledger Tables - -SchemaHierarchy_DroppedLedgerViews = Dropped Ledger Views - -SchemaHierarchy_AlwaysEncryptedKeys = Always Encrypted Keys - -SchemaHierarchy_ColumnMasterKeys = Column Master Keys - -SchemaHierarchy_ColumnEncryptionKeys = Column Encryption Keys - -SchemaHierarchy_SubroutineParameterLabelFormatString = {0} ({1}, {2}, {3}) - -SchemaHierarchy_SubroutineParameterNoDefaultLabel = No default - -SchemaHierarchy_SubroutineParameterInputLabel = Input - -SchemaHierarchy_SubroutineParameterInputOutputLabel = Input/Output - -SchemaHierarchy_SubroutineParameterInputReadOnlyLabel = Input/ReadOnly - -SchemaHierarchy_SubroutineParameterInputOutputReadOnlyLabel = Input/Output/ReadOnly - -SchemaHierarchy_SubroutineParameterDefaultLabel = Default - -SchemaHierarchy_NullColumn_Label = null - -SchemaHierarchy_NotNullColumn_Label = not null - -SchemaHierarchy_UDDTLabelWithType = {0} ({1}, {2}) - -SchemaHierarchy_UDDTLabelWithoutType = {0} ({1}) - -SchemaHierarchy_ComputedColumnLabelWithType = {0} ({1}Computed, {2}, {3}) - -SchemaHierarchy_ComputedColumnLabelWithoutType = {0} ({1}Computed) - -SchemaHierarchy_ColumnSetLabelWithoutType = {0} (Column Set, {1}) - -SchemaHierarchy_ColumnSetLabelWithType = {0} (Column Set, {1}{2}, {3}) - -SchemaHierarchy_ColumnSetLabelWithTypeAndKeyString = {0} (Column Set, {1}, {2}, {3}) - -UniqueIndex_LabelPart = Unique - -NonUniqueIndex_LabelPart = Non-Unique - -ClusteredIndex_LabelPart = Clustered - -NonClusteredIndex_LabelPart = Non-Clustered - -History_LabelPart = History - -SystemVersioned_LabelPart = System-Versioned - -UpdatableLedger_LabelPart = Updatable Ledger - -AppendOnlyLedger_LabelPart = Append-Only Ledger - -Ledger_LabelPart = Ledger - -External_LabelPart = External - -FileTable_LabelPart = File Table - -DatabaseNotAccessible = The database {0} is not accessible. - -FilterName = Name -FilterNameDescription = Include or exclude objects based on the name or part of a name. -FilterSchema = Schema -FilterSchemaDescription = Include or exclude objects based on the schema or part of a schema name. -FilterOwner = Owner -FilterOwnerDescription = Include or exclude objects based on the owner or part of an owner name. -FilterDurabilityType = Durability Type -FilterDurabilityTypeDescription = Include or exclude objects based on the durability type. -FilterDurabilitySchemaOnly = Schema Only -FilterDurabilitySchemaAndData = Schema and Data -FilterIsMemoryOptimized = Is Memory Optimized -FilterIsMemoryOptimizedDescription = Include or exclude objects based on whether the object is memory optimized. -FilterCreateDate = Create Date -FilterCreateDateDescription = Include or exclude objects based on their creation date. -FilterIsNativelyCompiled = Is Natively Compiled -FilterIsNativelyCompiledDescription = Include or exclude objects based on whether the object is natively compiled. -FilterInPrimaryKey = In Primary Key -FilterInPrimaryKeyDescription = Include or exclude objects based on whether the column is in a primary key. - ############################################################################ # Scripting Service diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf index d23596ff..1a037aef 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf @@ -457,816 +457,6 @@ Table or view requested for edit could not be found - - Error expanding: {0} - Error expanding: {0} - - - - Error connecting to {0} - Error connecting to {0} - - - - Aggregates - Aggregates - - - - Server Roles - Server Roles - - - - Application Roles - Application Roles - - - - Assemblies - Assemblies - - - - Assembly Files - Assembly Files - - - - Asymmetric Keys - Asymmetric Keys - - - - Asymmetric Keys - Asymmetric Keys - - - - Data Compression Options - Data Compression Options - - - - Certificates - Certificates - - - - FileTables - FileTables - - - - Certificates - Certificates - - - - Check Constraints - Check Constraints - - - - Columns - Columns - - - - Constraints - Constraints - - - - Contracts - Contracts - - - - Credentials - Credentials - - - - Error Messages - Error Messages - - - - Server Role Membership - Server Role Membership - - - - Database Options - Database Options - - - - Database Roles - Database Roles - - - - Role Memberships - Role Memberships - - - - Database Triggers - Database Triggers - - - - Default Constraints - Default Constraints - - - - Defaults - Defaults - - - - Sequences - Sequences - - - - Endpoints - Endpoints - - - - Event Notifications - Event Notifications - - - - Server Event Notifications - Server Event Notifications - - - - Extended Properties - Extended Properties - - - - Filegroups - Filegroups - - - - Foreign Keys - Foreign Keys - - - - Full-Text Catalogs - Full-Text Catalogs - - - - Full-Text Indexes - Full-Text Indexes - - - - Functions - Functions - - - - Indexes - Indexes - - - - Inline Functions - Inline Functions - - - - Keys - Keys - - - - Linked Servers - Linked Servers - - - - Logins - Logins - - - - Master Key - Master Key - - - - Master Keys - Master Keys - - - - Message Types - Message Types - - - - Table-Valued Functions - Table-Valued Functions - - - - Parameters - Parameters - - - - Partition Functions - Partition Functions - - - - Partition Schemes - Partition Schemes - - - - Permissions - Permissions - - - - Primary Keys - Primary Keys - - - - Programmability - Programmability - - - - Queues - Queues - - - - Remote Service Bindings - Remote Service Bindings - - - - Returned Columns - Returned Columns - - - - Roles - Roles - - - - Routes - Routes - - - - Rules - Rules - - - - Schemas - Schemas - - - - Security - Security - - - - Server Objects - Server Objects - - - - Management - Management - - - - Triggers - Triggers - - - - Service Broker - Service Broker - - - - Services - Services - - - - Signatures - Signatures - - - - Log Files - Log Files - - - - Statistics - Statistics - - - - Storage - Storage - - - - Stored Procedures - Stored Procedures - - - - Symmetric Keys - Symmetric Keys - - - - Synonyms - Synonyms - - - - Tables - Tables - - - - Triggers - Triggers - - - - Types - Types - - - - Unique Keys - Unique Keys - - - - User-Defined Data Types - User-Defined Data Types - - - - User-Defined Types (CLR) - User-Defined Types (CLR) - - - - Users - Users - - - - Views - Views - - - - XML Indexes - XML Indexes - - - - XML Schema Collections - XML Schema Collections - - - - User-Defined Table Types - User-Defined Table Types - - - - Files - Files - - - - Missing Caption - Missing Caption - - - - Broker Priorities - Broker Priorities - - - - Cryptographic Providers - Cryptographic Providers - - - - Database Audit Specifications - Database Audit Specifications - - - - Database Encryption Keys - Database Encryption Keys - - - - Event Sessions - Event Sessions - - - - Full Text Stoplists - Full Text Stoplists - - - - Resource Pools - Resource Pools - - - - Audits - Audits - - - - Server Audit Specifications - Server Audit Specifications - - - - Spatial Indexes - Spatial Indexes - - - - Workload Groups - Workload Groups - - - - SQL Files - SQL Files - - - - Server Functions - Server Functions - - - - SQL Type - SQL Type - - - - Server Options - Server Options - - - - Database Diagrams - Database Diagrams - - - - System Tables - System Tables - - - - Databases - Databases - - - - System Contracts - System Contracts - - - - System Databases - System Databases - - - - System Message Types - System Message Types - - - - System Queues - System Queues - - - - System Services - System Services - - - - System Stored Procedures - System Stored Procedures - - - - System Views - System Views - - - - Data-tier Applications - Data-tier Applications - - - - Extended Stored Procedures - Extended Stored Procedures - - - - Aggregate Functions - Aggregate Functions - - - - Approximate Numerics - Approximate Numerics - - - - Binary Strings - Binary Strings - - - - Character Strings - Character Strings - - - - CLR Data Types - CLR Data Types - - - - Configuration Functions - Configuration Functions - - - - Cursor Functions - Cursor Functions - - - - System Data Types - System Data Types - - - - Date and Time - Date and Time - - - - Date and Time Functions - Date and Time Functions - - - - Exact Numerics - Exact Numerics - - - - System Functions - System Functions - - - - Hierarchy Id Functions - Hierarchy Id Functions - - - - Mathematical Functions - Mathematical Functions - - - - Metadata Functions - Metadata Functions - - - - Other Data Types - Other Data Types - - - - Other Functions - Other Functions - - - - Rowset Functions - Rowset Functions - - - - Security Functions - Security Functions - - - - Spatial Data Types - Spatial Data Types - - - - String Functions - String Functions - - - - System Statistical Functions - System Statistical Functions - - - - Text and Image Functions - Text and Image Functions - - - - Unicode Character Strings - Unicode Character Strings - - - - Aggregate Functions - Aggregate Functions - - - - Scalar-valued Functions - Scalar-valued Functions - - - - Table-valued Functions - Table-valued Functions - - - - System Extended Stored Procedures - System Extended Stored Procedures - - - - Built-in Types - Built-in Types - - - - Built-in Server Roles - Built-in Server Roles - - - - User with Password - User with Password - - - - Search Property List - Search Property List - - - - Security Policies - Security Policies - - - - Security Predicates - Security Predicates - - - - Server Role - Server Role - - - - Search Property Lists - Search Property Lists - - - - Column Store Indexes - Column Store Indexes - - - - Table Type Indexes - Table Type Indexes - - - - Selective XML Indexes - Selective XML Indexes - - - - XML Namespaces - XML Namespaces - - - - XML Typed Promoted Paths - XML Typed Promoted Paths - - - - T-SQL Typed Promoted Paths - T-SQL Typed Promoted Paths - - - - Database Scoped Credentials - Database Scoped Credentials - - - - External Data Sources - External Data Sources - - - - External File Formats - External File Formats - - - - External Resources - External Resources - - - - External Tables - External Tables - - - - Always Encrypted Keys - Always Encrypted Keys - - - - Column Master Keys - Column Master Keys - - - - Column Encryption Keys - Column Encryption Keys - - - - Server - Server - - Error parsing ScriptingParams.ConnectionString property. Error parsing ScriptingParams.ConnectionString property. @@ -1282,121 +472,6 @@ Error parsing ScriptingListObjectsCompleteParams.ConnectionString property. - - {0} ({1}, {2}, {3}) - {0} ({1}, {2}, {3}) - - - - No default - No default - - - - Input - Input - - - - Input/Output - Input/Output - - - - Input/ReadOnly - Input/ReadOnly - - - - Input/Output/ReadOnly - Input/Output/ReadOnly - - - - Default - Default - - - - null - null - - - - not null - not null - - - - {0} ({1}, {2}) - {0} ({1}, {2}) - - - - {0} ({1}) - {0} ({1}) - - - - {0} ({1}Computed, {2}, {3}) - {0} ({1}Computed, {2}, {3}) - - - - {0} ({1}Computed) - {0} ({1}Computed) - - - - {0} (Column Set, {1}) - {0} (Column Set, {1}) - - - - {0} (Column Set, {1}{2}, {3}) - {0} (Column Set, {1}{2}, {3}) - - - - {0} (Column Set, {1}, {2}, {3}) - {0} (Column Set, {1}, {2}, {3}) - - - - Unique - Unique - - - - Non-Unique - Non-Unique - - - - Clustered - Clustered - - - - Non-Clustered - Non-Clustered - - - - History - History - - - - System-Versioned - System-Versioned - - - - The database {0} is not accessible. - The database {0} is not accessible. - - Query has no results to return Query has no results to return @@ -1628,16 +703,6 @@ Scripting as Execute is only supported for Stored Procedures - - External - External - - - - File Table - File Table - - EditData queries targeting multiple tables are not supported EditData queries targeting multiple tables are not supported @@ -6307,36 +5372,6 @@ The Query Processor estimates that implementing the following index could improv . Parameters: 0 - columnName (string), 1 - indexName (string), 2 - rowNumber (int) - - Updatable Ledger - Updatable Ledger - - - - Append-Only Ledger - Append-Only Ledger - - - - Ledger - Ledger - - - - Dropped Ledger Tables - Dropped Ledger Tables - - - - Dropped Ledger Views - Dropped Ledger Views - - - - Dropped Ledger Columns - Dropped Ledger Columns - - Could not find SQL model from project: {0}. Could not find SQL model from project: {0}. @@ -6540,11 +5575,6 @@ The Query Processor estimates that implementing the following index could improv Sequence Number End - - Built-in Schemas - Built-in Schemas - - Attestation URL cannot be empty with the selected value of Attestation protocol. Attestation URL cannot be empty with the selected value of Attestation protocol. @@ -7132,76 +6162,6 @@ The Query Processor estimates that implementing the following index could improv Impersonate Any Login - - Name - Name - - - - Include or exclude objects based on the name or part of a name. - Include or exclude objects based on the name or part of a name. - - - - Schema - Schema - - - - Include or exclude objects based on the schema or part of a schema name. - Include or exclude objects based on the schema or part of a schema name. - - - - Owner - Owner - - - - Include or exclude objects based on the owner or part of an owner name. - Include or exclude objects based on the owner or part of an owner name. - - - - Durability Type - Durability Type - - - - Include or exclude objects based on the durability type. - Include or exclude objects based on the durability type. - - - - Is Memory Optimized - Is Memory Optimized - - - - Include or exclude objects based on whether the object is memory optimized. - Include or exclude objects based on whether the object is memory optimized. - - - - Create Date - Create Date - - - - Include or exclude objects based on their creation date. - Include or exclude objects based on their creation date. - - - - Is Natively Compiled - Is Natively Compiled - - - - Include or exclude objects based on whether the object is natively compiled. - Include or exclude objects based on whether the object is natively compiled. - - SetServiceProvider() was not called to establish the required service provider SetServiceProvider() was not called to establish the required service provider @@ -7571,26 +6531,6 @@ The Query Processor estimates that implementing the following index could improv Default Default - - In Primary Key - In Primary Key - - - - Include or exclude objects based on whether the column is in a primary key. - Include or exclude objects based on whether the column is in a primary key. - - - - Schema Only - Schema Only - - - - Schema and Data - Schema and Data - - Change Autogrowth for {0} Change Autogrowth for {0} diff --git a/src/Microsoft.SqlTools.ServiceLayer/Management/Common/Utils.cs b/src/Microsoft.SqlTools.ServiceLayer/Management/Common/Utils.cs index 508881ee..0c8ab7eb 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Management/Common/Utils.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Management/Common/Utils.cs @@ -8,9 +8,9 @@ using System; using Microsoft.Data.SqlClient; using System.Globalization; -using System.Text; using Microsoft.SqlServer.Management.Common; using SMO = Microsoft.SqlServer.Management.Smo; +using Microsoft.SqlTools.SqlCore.Utility; namespace Microsoft.SqlTools.ServiceLayer.Management { @@ -173,7 +173,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Management { string query = string.Format(CultureInfo.InvariantCulture, "select top 1 1 from [{0}].sys.filegroups where type = 'FX'", - CUtils.EscapeString(dbName, ']')); + StringUtils.EscapeString(dbName, ']')); if (server.ConnectionContext.ExecuteScalar(query) != null) { hasMemoryOptimizedFileGroup = true; @@ -552,101 +552,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Management return sqlerror.Number; } - /// - /// Function doubles up specified character in a string - /// - /// - /// - /// - public static String EscapeString(string s, char cEsc) - { - if (string.IsNullOrWhiteSpace(s)) - { - return s; - } - - StringBuilder sb = new StringBuilder(s.Length * 2); - foreach (char c in s) - { - sb.Append(c); - if (cEsc == c) - sb.Append(c); - } - return sb.ToString(); - } - - /// - /// Function doubles up ']' character in a string - /// - /// - /// - public static String EscapeStringCBracket(string s) - { - return CUtils.EscapeString(s, ']'); - } - - /// - /// Function doubles up '\'' character in a string - /// - /// - /// - public static String EscapeStringSQuote(string s) - { - return CUtils.EscapeString(s, '\''); - } - - /// - /// Function removes doubled up specified character from a string - /// - /// - /// - /// - public static String UnEscapeString(string s, char cEsc) - { - StringBuilder sb = new StringBuilder(s.Length); - bool foundBefore = false; - foreach (char c in s) - { - if (cEsc == c) // character to unescape - { - if (foundBefore) // skip second occurrence - { - foundBefore = false; - } - else // set the flag to skip next time around - { - sb.Append(c); - foundBefore = true; - } - } - else - { - sb.Append(c); - foundBefore = false; - } - } - return sb.ToString(); - } - - /// - /// Function removes doubled up ']' character from a string - /// - /// - /// - public static String UnEscapeStringCBracket(string s) - { - return CUtils.UnEscapeString(s, ']'); - } - - /// - /// Function removes doubled up '\'' character from a string - /// - /// - /// - public static String UnEscapeStringSQuote(string s) - { - return CUtils.UnEscapeString(s, '\''); - } + /// /// Get the windows login name with the domain portion in all-caps diff --git a/src/Microsoft.SqlTools.ServiceLayer/Metadata/Contracts/MetadataListRequest.cs b/src/Microsoft.SqlTools.ServiceLayer/Metadata/Contracts/MetadataListRequest.cs index a3b04745..542b0499 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Metadata/Contracts/MetadataListRequest.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Metadata/Contracts/MetadataListRequest.cs @@ -6,6 +6,7 @@ #nullable disable using Microsoft.SqlTools.Hosting.Protocol.Contracts; +using Microsoft.SqlTools.SqlCore.Metadata; namespace Microsoft.SqlTools.ServiceLayer.Metadata.Contracts { diff --git a/src/Microsoft.SqlTools.ServiceLayer/Metadata/MetadataService.cs b/src/Microsoft.SqlTools.ServiceLayer/Metadata/MetadataService.cs index 382567ca..4996852a 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Metadata/MetadataService.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Metadata/MetadataService.cs @@ -14,6 +14,7 @@ using Microsoft.SqlTools.ServiceLayer.Connection; using Microsoft.SqlTools.ServiceLayer.Hosting; using Microsoft.SqlTools.ServiceLayer.Metadata.Contracts; using Microsoft.SqlTools.ServiceLayer.Utility; +using Microsoft.SqlTools.SqlCore.Metadata; namespace Microsoft.SqlTools.ServiceLayer.Metadata { diff --git a/src/Microsoft.SqlTools.ServiceLayer/Metadata/SmoMetadataFactory.cs b/src/Microsoft.SqlTools.ServiceLayer/Metadata/SmoMetadataFactory.cs index 1a8e0388..9e722e3d 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Metadata/SmoMetadataFactory.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Metadata/SmoMetadataFactory.cs @@ -11,9 +11,9 @@ using System.Data.Common; using Microsoft.Data.SqlClient; using Microsoft.SqlServer.Management.Common; using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.Connection; using Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection; using Microsoft.SqlTools.ServiceLayer.Utility.SqlScriptFormatters; +using Microsoft.SqlTools.SqlCore.Connection; namespace Microsoft.SqlTools.ServiceLayer.Metadata { diff --git a/src/Microsoft.SqlTools.ServiceLayer/Microsoft.SqlTools.ServiceLayer.csproj b/src/Microsoft.SqlTools.ServiceLayer/Microsoft.SqlTools.ServiceLayer.csproj index 7f414b40..81a0f158 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Microsoft.SqlTools.ServiceLayer.csproj +++ b/src/Microsoft.SqlTools.ServiceLayer/Microsoft.SqlTools.ServiceLayer.csproj @@ -60,13 +60,13 @@ - + + Always - diff --git a/src/Microsoft.SqlTools.ServiceLayer/ModelManagement/ModelOperations.cs b/src/Microsoft.SqlTools.ServiceLayer/ModelManagement/ModelOperations.cs index f53ff1b7..eb4e5980 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ModelManagement/ModelOperations.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ModelManagement/ModelOperations.cs @@ -5,9 +5,8 @@ #nullable disable -using Microsoft.SqlTools.ServiceLayer.Management; using Microsoft.SqlTools.ServiceLayer.ModelManagement.Contracts; -using Microsoft.SqlTools.ServiceLayer.Utility; +using Microsoft.SqlTools.SqlCore.Utility; using System; using System.Collections.Generic; using System.Data; @@ -253,12 +252,12 @@ namespace Microsoft.SqlTools.ServiceLayer.ModelManagement private static string GetThreePartsTableName(string dbName, string tableName, string schemaName) { - return $"[{CUtils.EscapeStringCBracket(dbName)}].[{CUtils.EscapeStringCBracket(schemaName)}].[{CUtils.EscapeStringCBracket(tableName)}]"; + return $"[{StringUtils.EscapeStringCBracket(dbName)}].[{StringUtils.EscapeStringCBracket(schemaName)}].[{StringUtils.EscapeStringCBracket(tableName)}]"; } private static string GetTwoPartsTableName(string tableName, string schemaName) { - return $"[{CUtils.EscapeStringCBracket(schemaName)}].[{CUtils.EscapeStringCBracket(tableName)}]"; + return $"[{StringUtils.EscapeStringCBracket(schemaName)}].[{StringUtils.EscapeStringCBracket(tableName)}]"; } private static string GetSelectModelsQuery(string dbName, string tableName, string schemaName) @@ -272,24 +271,24 @@ namespace Microsoft.SqlTools.ServiceLayer.ModelManagement private static string GetConfigTableVerificationQuery(string dbName, string tableName, string schemaName) { - string twoPartsTableName = GetTwoPartsTableName(CUtils.EscapeStringSQuote(tableName), CUtils.EscapeStringSQuote(schemaName)); + string twoPartsTableName = GetTwoPartsTableName(StringUtils.EscapeStringSQuote(tableName), StringUtils.EscapeStringSQuote(schemaName)); return $@" IF NOT EXISTS ( SELECT name FROM sys.databases - WHERE name = N'{CUtils.EscapeStringSQuote(dbName)}' + WHERE name = N'{StringUtils.EscapeStringSQuote(dbName)}' ) BEGIN SELECT 0 END ELSE BEGIN - USE [{CUtils.EscapeStringCBracket(dbName)}] + USE [{StringUtils.EscapeStringCBracket(dbName)}] IF EXISTS ( SELECT t.name, s.name FROM sys.tables t join sys.schemas s on t.schema_id=t.schema_id - WHERE t.name = '{CUtils.EscapeStringSQuote(tableName)}' - AND s.name = '{CUtils.EscapeStringSQuote(schemaName)}' + WHERE t.name = '{StringUtils.EscapeStringSQuote(tableName)}' + AND s.name = '{StringUtils.EscapeStringSQuote(schemaName)}' ) BEGIN IF EXISTS (SELECT * FROM syscolumns WHERE ID=OBJECT_ID('{twoPartsTableName}') AND NAME='model_name') @@ -323,8 +322,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ModelManagement IF NOT EXISTS ( SELECT t.name, s.name FROM sys.tables t join sys.schemas s on t.schema_id=t.schema_id - WHERE t.name = '{CUtils.EscapeStringSQuote(tableName)}' - AND s.name = '{CUtils.EscapeStringSQuote(schemaName)}' + WHERE t.name = '{StringUtils.EscapeStringSQuote(tableName)}' + AND s.name = '{StringUtils.EscapeStringSQuote(schemaName)}' ) BEGIN CREATE TABLE {GetTwoPartsTableName(tableName, schemaName)} ( @@ -339,12 +338,12 @@ namespace Microsoft.SqlTools.ServiceLayer.ModelManagement [deployed_by] [int] NULL, [model_description] [varchar](256) NULL, [run_id] [varchar](256) NULL, - CONSTRAINT [{CUtils.EscapeStringCBracket(tableName)}_models_pk] PRIMARY KEY CLUSTERED + CONSTRAINT [{StringUtils.EscapeStringCBracket(tableName)}_models_pk] PRIMARY KEY CLUSTERED ( [model_id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] - ALTER TABLE {GetTwoPartsTableName(tableName, schemaName)} ADD CONSTRAINT [{CUtils.EscapeStringCBracket(tableName)}_deployment_time] DEFAULT (getdate()) FOR [model_deployment_time] + ALTER TABLE {GetTwoPartsTableName(tableName, schemaName)} ADD CONSTRAINT [{StringUtils.EscapeStringCBracket(tableName)}_deployment_time] DEFAULT (getdate()) FOR [model_deployment_time] END "; } @@ -357,14 +356,14 @@ namespace Microsoft.SqlTools.ServiceLayer.ModelManagement INSERT INTO {twoPartsTableName} (model_name, model, model_version, model_description, model_creation_time, model_framework, model_framework_version, run_id, deployed_by) VALUES ( - {DatabaseUtils.AddStringParameterForInsert(model.ModelName ?? "")}, - {DatabaseUtils.AddByteArrayParameterForInsert("Content", model.FilePath ?? "", parameters)}, - {DatabaseUtils.AddStringParameterForInsert(model.Version ?? "")}, - {DatabaseUtils.AddStringParameterForInsert(model.Description ?? "")}, - {DatabaseUtils.AddStringParameterForInsert(model.Created)}, - {DatabaseUtils.AddStringParameterForInsert(model.Framework ?? "")}, - {DatabaseUtils.AddStringParameterForInsert(model.FrameworkVersion ?? "")}, - {DatabaseUtils.AddStringParameterForInsert(model.RunId ?? "")}, + {Utility.DatabaseUtils.AddStringParameterForInsert(model.ModelName ?? "")}, + {Utility.DatabaseUtils.AddByteArrayParameterForInsert("Content", model.FilePath ?? "", parameters)}, + {Utility.DatabaseUtils.AddStringParameterForInsert(model.Version ?? "")}, + {Utility.DatabaseUtils.AddStringParameterForInsert(model.Description ?? "")}, + {Utility.DatabaseUtils.AddStringParameterForInsert(model.Created)}, + {Utility.DatabaseUtils.AddStringParameterForInsert(model.Framework ?? "")}, + {Utility.DatabaseUtils.AddStringParameterForInsert(model.FrameworkVersion ?? "")}, + {Utility.DatabaseUtils.AddStringParameterForInsert(model.RunId ?? "")}, USER_ID (Current_User) ) "; @@ -378,13 +377,13 @@ namespace Microsoft.SqlTools.ServiceLayer.ModelManagement return $@" UPDATE {twoPartsTableName} SET - {DatabaseUtils.AddStringParameterForUpdate("model_name", model.ModelName ?? "")}, - {DatabaseUtils.AddStringParameterForUpdate("model_version", model.Version ?? "")}, - {DatabaseUtils.AddStringParameterForUpdate("model_description", model.Description ?? "")}, - {DatabaseUtils.AddStringParameterForUpdate("model_creation_time", model.Created)}, - {DatabaseUtils.AddStringParameterForUpdate("model_framework", model.Framework ?? "")}, - {DatabaseUtils.AddStringParameterForUpdate("model_framework_version", model.FrameworkVersion ?? "")}, - {DatabaseUtils.AddStringParameterForUpdate("run_id", model.RunId ?? "")} + {Utility.DatabaseUtils.AddStringParameterForUpdate("model_name", model.ModelName ?? "")}, + {Utility.DatabaseUtils.AddStringParameterForUpdate("model_version", model.Version ?? "")}, + {Utility.DatabaseUtils.AddStringParameterForUpdate("model_description", model.Description ?? "")}, + {Utility.DatabaseUtils.AddStringParameterForUpdate("model_creation_time", model.Created)}, + {Utility.DatabaseUtils.AddStringParameterForUpdate("model_framework", model.Framework ?? "")}, + {Utility.DatabaseUtils.AddStringParameterForUpdate("model_framework_version", model.FrameworkVersion ?? "")}, + {Utility.DatabaseUtils.AddStringParameterForUpdate("run_id", model.RunId ?? "")} WHERE model_id = @{ModelIdParameterName} "; diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Contracts/ExpandRequest.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Contracts/ExpandRequest.cs index 933765e9..e091ff87 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Contracts/ExpandRequest.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Contracts/ExpandRequest.cs @@ -6,7 +6,7 @@ #nullable disable using Microsoft.SqlTools.Hosting.Protocol.Contracts; -using Microsoft.SqlTools.ServiceLayer.Connection.Contracts; +using Microsoft.SqlTools.SqlCore.Connection; namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts { diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Contracts/NodeInfo.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Contracts/NodeInfo.cs index 0ad04e10..b2bfba1e 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Contracts/NodeInfo.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Contracts/NodeInfo.cs @@ -5,7 +5,10 @@ #nullable disable -using Microsoft.SqlTools.ServiceLayer.Metadata.Contracts; +using System; +using System.Collections.Generic; +using Microsoft.SqlTools.SqlCore.Metadata; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; using Newtonsoft.Json.Linq; namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts @@ -76,6 +79,25 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts /// Filterable properties that this node supports /// public NodeFilterProperty[] FilterableProperties { get; set; } + + public NodeInfo() + { + } + + public NodeInfo(TreeNode treeNode) + { + IsLeaf = treeNode.IsAlwaysLeaf; + Label = treeNode.Label; + NodePath = treeNode.GetNodePath(); + ParentNodePath = treeNode.Parent?.GetNodePath() ?? string.Empty; + NodeType = treeNode.NodeType; + Metadata = treeNode.ObjectMetadata; + NodeStatus = treeNode.NodeStatus; + NodeSubType = treeNode.NodeSubType; + ErrorMessage = treeNode.ErrorMessage; + ObjectType = treeNode.NodeTypeId.ToString(); + FilterableProperties = treeNode.FilterProperties; + } } /// @@ -103,45 +125,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts } } - /// - /// The filterable properties that a node supports - /// - public class NodeFilterProperty - { - /// - /// The name of the filter property - /// - public string Name { get; set; } - /// - /// The name of the filter property displayed to the user - /// - public string DisplayName { get; set; } - /// - /// The description of the filter property - /// - public string Description { get; set; } - /// - /// The data type of the filter property - /// - public NodeFilterPropertyDataType Type { get; set; } - /// - /// The list of choices for the filter property if the type is choice - /// - public NodeFilterPropertyChoice[] Choices { get; set; } - } - - /// - /// The data type of the filter property. Matches NodeFilterPropertyDataType enum in ADS : https://github.com/microsoft/azuredatastudio/blob/main/src/sql/azdata.proposed.d.ts#L1847-L1853 - /// - public enum NodeFilterPropertyDataType - { - String = 0, - Number = 1, - Boolean = 2, - Date = 3, - Choice = 4 - } - /// /// The operator of the filter property. Matches NodeFilterOperator enum in ADS: https://github.com/microsoft/azuredatastudio/blob/main/src/sql/azdata.proposed.d.ts#L1855-L1868 /// @@ -182,22 +165,109 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts /// The applied values of the filter property /// public JToken Value { get; set; } - } + - /// - /// The choice for the filter property if the type is choice - /// - public class NodeFilterPropertyChoice - { - /// - /// The dropdown display value for the choice - /// - /// - public string DisplayName { get; set; } + public INodeFilter ToINodeFilter(NodeFilterProperty filterProperty) + { + Type type = typeof(string); - /// - /// The value of the choice - /// - public string Value { get; set; } + var IsDateTime = filterProperty.Type == NodeFilterPropertyDataType.Date; + + FilterType filterType = FilterType.EQUALS; + bool isNotFilter = false; + + object filterValue = null; + + switch (filterProperty.Type) + { + case NodeFilterPropertyDataType.String: + case NodeFilterPropertyDataType.Date: + case NodeFilterPropertyDataType.Choice: + type = typeof(string); + filterValue = this.Value.ToString(); + break; + case NodeFilterPropertyDataType.Number: + type = typeof(int); + filterValue = this.Value.ToObject(); + break; + case NodeFilterPropertyDataType.Boolean: + type = typeof(bool); + filterValue = this.Value.ToObject() ? 1 : 0; + break; + } + + switch (this.Operator) + { + case NodeFilterOperator.Equals: + filterType = FilterType.EQUALS; + break; + case NodeFilterOperator.NotEquals: + filterType = FilterType.EQUALS; + isNotFilter = true; + break; + case NodeFilterOperator.LessThan: + filterType = FilterType.LESSTHAN; + break; + case NodeFilterOperator.LessThanOrEquals: + filterType = FilterType.LESSTHANOREQUAL; + break; + case NodeFilterOperator.GreaterThan: + filterType = FilterType.GREATERTHAN; + break; + case NodeFilterOperator.GreaterThanOrEquals: + filterType = FilterType.GREATERTHANOREQUAL; + break; + case NodeFilterOperator.Between: + filterType = FilterType.BETWEEN; + break; + case NodeFilterOperator.NotBetween: + filterType = FilterType.NOTBETWEEN; + isNotFilter = true; + break; + case NodeFilterOperator.Contains: + filterType = FilterType.CONTAINS; + break; + case NodeFilterOperator.NotContains: + filterType = FilterType.CONTAINS; + isNotFilter = true; + break; + case NodeFilterOperator.StartsWith: + filterType = FilterType.STARTSWITH; + break; + case NodeFilterOperator.NotStartsWith: + filterType = FilterType.STARTSWITH; + isNotFilter = true; + break; + case NodeFilterOperator.EndsWith: + filterType = FilterType.ENDSWITH; + break; + case NodeFilterOperator.NotEndsWith: + filterType = FilterType.ENDSWITH; + isNotFilter = true; + break; + } + + if (this.Operator == NodeFilterOperator.Between || this.Operator == NodeFilterOperator.NotBetween) + { + if (filterProperty.Type == NodeFilterPropertyDataType.Number) + { + filterValue = this.Value.ToObject(); + } + else if (filterProperty.Type == NodeFilterPropertyDataType.Date) + { + filterValue = this.Value.ToObject(); + } + } + + return new NodePropertyFilter + { + Property = filterProperty.Name, + Type = type, + Values = new List { filterValue }, + IsNotFilter = isNotFilter, + FilterType = filterType, + IsDateTime = IsDateTime + }; + } } } diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs index 4fb8c223..270b17c7 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs @@ -23,12 +23,14 @@ using Microsoft.SqlTools.ServiceLayer.Connection; using Microsoft.SqlTools.ServiceLayer.Connection.Contracts; using Microsoft.SqlTools.ServiceLayer.LanguageServices; using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel; using Microsoft.SqlTools.ServiceLayer.SqlContext; using Microsoft.SqlTools.ServiceLayer.TableDesigner; using Microsoft.SqlTools.ServiceLayer.Utility; using Microsoft.SqlTools.ServiceLayer.Workspace; +using Microsoft.SqlTools.SqlCore.Connection; +using Microsoft.SqlTools.SqlCore.ObjectExplorer; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel; using Microsoft.SqlTools.Utility; namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer @@ -46,7 +48,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer private ConnectionService connectionService; private IProtocolEndpoint serviceHost; private ConcurrentDictionary sessionMap; - private readonly Lazy>> applicableNodeChildFactories; private IMultiServiceProvider serviceProvider; private ConnectedBindingQueue bindingQueue = new ConnectedBindingQueue(needsMetadata: false); private string connectionName = "ObjectExplorer"; @@ -62,7 +63,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer public ObjectExplorerService() { sessionMap = new ConcurrentDictionary(); - applicableNodeChildFactories = new Lazy>>(PopulateFactories); NodePathGenerator.Initialize(); } @@ -78,14 +78,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer } } - private Dictionary> ApplicableNodeChildFactories - { - get - { - return applicableNodeChildFactories.Value; - } - } - /// /// Returns the session ids /// @@ -286,7 +278,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer var foundNodes = FindNodes(findNodesParams.SessionId, findNodesParams.Type, findNodesParams.Schema, findNodesParams.Name, findNodesParams.Database, findNodesParams.ParentObjectNames); foundNodes ??= new List(); - await context.SendResult(new FindNodesResponse { Nodes = foundNodes.Select(node => node.ToNodeInfo()).ToList() }); + await context.SendResult(new FindNodesResponse { Nodes = foundNodes.Select(node => new NodeInfo(node)).ToList() }); } internal void CloseSession(string uri) @@ -365,7 +357,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer response = new SessionCreatedParameters { Success = true, - RootNode = session.Root.ToNodeInfo(), + RootNode = new NodeInfo(session.Root), SessionId = uri, ErrorNumber = session.ErrorNumber, ErrorMessage = session.ErrorMessage @@ -444,17 +436,30 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer securityToken = null; } + var filterDefinitions = node.FilterProperties; + var appliedFilters = new List(); + + if (filters != null) + { + foreach (var f in filters) + { + NodeFilterProperty filterProperty = filterDefinitions.FirstOrDefault(x => x.Name == f.Name); + appliedFilters.Add(f.ToINodeFilter(filterProperty)); + } + } + + if (forceRefresh) { Logger.Verbose($"Forcing refresh for {nodePath}"); - nodes = node.Refresh(cancelToken, securityToken?.Token, filters).Select(x => x.ToNodeInfo()).ToArray(); + nodes = node.Refresh(cancelToken, securityToken?.Token, appliedFilters).Select(x => new NodeInfo(x)).ToArray(); } else { Logger.Verbose($"Expanding {nodePath}"); try { - nodes = node.Expand(cancelToken, securityToken?.Token, filters).Select(x => x.ToNodeInfo()).ToArray(); + nodes = node.Expand(cancelToken, securityToken?.Token, appliedFilters).Select(x => new NodeInfo(x)).ToArray(); } catch (ConnectionFailureException ex) { @@ -534,7 +539,10 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer waitForLockTimeout: timeout, bindOperation: (bindingContext, cancelToken) => { - session = ObjectExplorerSession.CreateSession(connectionResult, serviceProvider, bindingContext.ServerConnection, isDefaultOrSystemDatabase); + session = ObjectExplorerSession.CreateSession(connectionResult, bindingContext.ServerConnection, isDefaultOrSystemDatabase, serviceProvider, () => + { + return WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer.GroupBySchema; + }); session.ConnectionInfo = connectionInfo; sessionMap.AddOrUpdate(uri, session, (key, oldSession) => session); @@ -687,39 +695,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer return ConnectedBindingQueue.GetConnectionContextKey(details); } - public IEnumerable GetApplicableChildFactories(TreeNode item) - { - if (ApplicableNodeChildFactories != null) - { - HashSet applicableFactories; - if (ApplicableNodeChildFactories.TryGetValue(item.NodeTypeId.ToString(), out applicableFactories)) - { - return applicableFactories; - } - } - return null; - } - - internal Dictionary> PopulateFactories() - { - VerifyServicesInitialized(); - - var childFactories = new Dictionary>(); - // Create our list of all NodeType to ChildFactory objects so we can expand appropriately - foreach (var factory in serviceProvider.GetServices()) - { - var parents = factory.ApplicableParents(); - if (parents != null) - { - foreach (var parent in parents) - { - AddToApplicableChildFactories(childFactories, factory, parent); - } - } - } - return childFactories; - } - private void VerifyServicesInitialized() { if (serviceProvider == null) @@ -821,27 +796,21 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer return string.Empty; } - internal class ObjectExplorerSession + internal class ObjectExplorerSession : IObjectExplorerSession { - private ConnectionService connectionService; - private IMultiServiceProvider serviceProvider; - // TODO decide whether a cache is needed to handle lookups in elements with a large # children //private const int Cachesize = 10000; //private Cache cache; - public ObjectExplorerSession(string uri, TreeNode root, IMultiServiceProvider serviceProvider, ConnectionService connectionService) + public ObjectExplorerSession(string uri, TreeNode root) { Validate.IsNotNullOrEmptyString("uri", uri); Validate.IsNotNull("root", root); Uri = uri; Root = root; - this.serviceProvider = serviceProvider; - this.connectionService = connectionService; } public string Uri { get; private set; } - public TreeNode Root { get; private set; } public ConnectionInfo ConnectionInfo { get; set; } @@ -849,10 +818,21 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer public string ErrorMessage { get; set; } - public static ObjectExplorerSession CreateSession(ConnectionCompleteParams response, IMultiServiceProvider serviceProvider, ServerConnection serverConnection, bool isDefaultOrSystemDatabase) + public static ObjectExplorerSession CreateSession(ConnectionCompleteParams response, ServerConnection serverConnection, bool isDefaultOrSystemDatabase, IMultiServiceProvider serviceProvider, Func groupBySchemaFlagGetter) { - ServerNode rootNode = new ServerNode(response, serviceProvider, serverConnection); - var session = new ObjectExplorerSession(response.OwnerUri, rootNode, serviceProvider, serviceProvider.GetService()); + ServerNode rootNode = new ServerNode(new ObjectExplorerServerInfo() + { + ServerName = response.ConnectionSummary.ServerName, + DatabaseName = response.ConnectionSummary.DatabaseName, + UserName = response.ConnectionSummary.UserName, + ServerVersion = response.ServerInfo.ServerVersion, + EngineEditionId = response.ServerInfo.EngineEditionId, + IsCloud = response.ServerInfo.IsCloud, + }, serverConnection, serviceProvider, () => + { + return WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer.GroupBySchema; + }); + var session = new ObjectExplorerSession(response.OwnerUri, rootNode); if (!isDefaultOrSystemDatabase) { // Assuming the databases are in a folder under server node diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerUtils.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerUtils.cs index 1ec176ee..e6b6e1ed 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerUtils.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerUtils.cs @@ -7,9 +7,7 @@ using System; using System.Threading; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts; -using System.Collections.Generic; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer { @@ -53,7 +51,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer /// determines whether to stop going further up the tree /// Predicate function to filter the children when traversing /// A Tree Node that matches the condition, or null if no matching node could be found - public static TreeNode? FindNode(TreeNode node, Predicate condition, Predicate filter, bool expandIfNeeded = false) + public static TreeNode? FindNode(TreeNode node, Predicate condition, Predicate filter, bool expandIfNeeded = false, CancellationToken cancellationToken = new CancellationToken()) { if (node == null) { @@ -64,7 +62,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer { return node; } - var children = expandIfNeeded && !node.IsAlwaysLeaf ? node.Expand(new CancellationToken()) : node.GetChildren(); + var children = expandIfNeeded && !node.IsAlwaysLeaf ? node.Expand(cancellationToken) : node.GetChildren(); foreach (var child in children) { if (filter != null && filter(child)) @@ -78,108 +76,5 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer } return null; } - - public static INodeFilter ConvertExpandNodeFilterToNodeFilter(NodeFilter filter, NodeFilterProperty filterProperty) - { - Type type = typeof(string); - - var IsDateTime = filterProperty.Type == NodeFilterPropertyDataType.Date; - - FilterType filterType = FilterType.EQUALS; - bool isNotFilter = false; - - object filterValue = null; - - switch (filterProperty.Type) - { - case NodeFilterPropertyDataType.String: - case NodeFilterPropertyDataType.Date: - case NodeFilterPropertyDataType.Choice: - type = typeof(string); - filterValue = filter.Value.ToString(); - break; - case NodeFilterPropertyDataType.Number: - type = typeof(int); - filterValue = filter.Value.ToObject(); - break; - case NodeFilterPropertyDataType.Boolean: - type = typeof(bool); - filterValue = filter.Value.ToObject() ? 1 : 0; - break; - } - - switch (filter.Operator) - { - case NodeFilterOperator.Equals: - filterType = FilterType.EQUALS; - break; - case NodeFilterOperator.NotEquals: - filterType = FilterType.EQUALS; - isNotFilter = true; - break; - case NodeFilterOperator.LessThan: - filterType = FilterType.LESSTHAN; - break; - case NodeFilterOperator.LessThanOrEquals: - filterType = FilterType.LESSTHANOREQUAL; - break; - case NodeFilterOperator.GreaterThan: - filterType = FilterType.GREATERTHAN; - break; - case NodeFilterOperator.GreaterThanOrEquals: - filterType = FilterType.GREATERTHANOREQUAL; - break; - case NodeFilterOperator.Between: - filterType = FilterType.BETWEEN; - break; - case NodeFilterOperator.NotBetween: - filterType = FilterType.NOTBETWEEN; - isNotFilter = true; - break; - case NodeFilterOperator.Contains: - filterType = FilterType.CONTAINS; - break; - case NodeFilterOperator.NotContains: - filterType = FilterType.CONTAINS; - isNotFilter = true; - break; - case NodeFilterOperator.StartsWith: - filterType = FilterType.STARTSWITH; - break; - case NodeFilterOperator.NotStartsWith: - filterType = FilterType.STARTSWITH; - isNotFilter = true; - break; - case NodeFilterOperator.EndsWith: - filterType = FilterType.ENDSWITH; - break; - case NodeFilterOperator.NotEndsWith: - filterType = FilterType.ENDSWITH; - isNotFilter = true; - break; - } - - if (filter.Operator == NodeFilterOperator.Between || filter.Operator == NodeFilterOperator.NotBetween) - { - if (filterProperty.Type == NodeFilterPropertyDataType.Number) - { - filterValue = filter.Value.ToObject(); - } - else if (filterProperty.Type == NodeFilterPropertyDataType.Date) - { - filterValue = filter.Value.ToObject(); - } - } - - return new NodePropertyFilter - { - Property = filterProperty.Name, - Type = type, - Values = new List { filterValue }, - IsNotFilter = isNotFilter, - FilterType = filterType, - IsDateTime = IsDateTime - }; - } } } diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Database/DatabaseHandler.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Database/DatabaseHandler.cs index 564b1252..bb0f94de 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Database/DatabaseHandler.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectManagement/ObjectTypes/Database/DatabaseHandler.cs @@ -20,6 +20,7 @@ using Microsoft.SqlTools.Utility; using System.Text; using System.IO; using Microsoft.SqlTools.ServiceLayer.Utility.SqlScriptFormatters; +using Microsoft.SqlTools.SqlCore.Utility; namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement { @@ -529,7 +530,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement // Update database file names now that we have a database name if (viewParams.IsNewObject && !prototype.HideFileSettings) { - var sanitizedName = DatabaseUtils.SanitizeDatabaseFileName(prototype.Name); + var sanitizedName = Utility.DatabaseUtils.SanitizeDatabaseFileName(prototype.Name); var dataFile = prototype.Files[0]; if (dataFile.DatabaseFileType != FileType.Data) diff --git a/src/Microsoft.SqlTools.ServiceLayer/Scripting/ScriptAsScriptingOperation.cs b/src/Microsoft.SqlTools.ServiceLayer/Scripting/ScriptAsScriptingOperation.cs index 88585b28..c92755a0 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Scripting/ScriptAsScriptingOperation.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Scripting/ScriptAsScriptingOperation.cs @@ -7,18 +7,18 @@ using System; using System.Collections.Generic; -using Microsoft.Data.SqlClient; -using Microsoft.SqlTools.ServiceLayer.Connection; -using Microsoft.SqlTools.ServiceLayer.Scripting.Contracts; -using Microsoft.SqlTools.Utility; -using Microsoft.SqlServer.Management.Common; -using Microsoft.SqlServer.Management.Smo; using System.Collections.Specialized; -using System.Text; using System.Globalization; -using Microsoft.SqlServer.Management.SqlScriptPublish; -using Microsoft.SqlTools.ServiceLayer.Utility; +using System.Text; +using Microsoft.Data.SqlClient; +using Microsoft.SqlServer.Management.Common; using Microsoft.SqlServer.Management.Sdk.Sfc; +using Microsoft.SqlServer.Management.Smo; +using Microsoft.SqlServer.Management.SqlScriptPublish; +using Microsoft.SqlTools.ServiceLayer.Scripting.Contracts; +using Microsoft.SqlTools.SqlCore.Connection; +using Microsoft.SqlTools.SqlCore.Utility; +using Microsoft.SqlTools.Utility; namespace Microsoft.SqlTools.ServiceLayer.Scripting { diff --git a/src/Microsoft.SqlTools.ServiceLayer/Scripting/SmoScriptingOperation.cs b/src/Microsoft.SqlTools.ServiceLayer/Scripting/SmoScriptingOperation.cs index 24abe388..c7ea6cd3 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Scripting/SmoScriptingOperation.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Scripting/SmoScriptingOperation.cs @@ -5,14 +5,14 @@ #nullable disable -using Microsoft.SqlServer.Management.Common; -using Microsoft.SqlTools.ServiceLayer.Connection; -using Microsoft.SqlTools.ServiceLayer.Scripting.Contracts; -using Microsoft.SqlTools.Utility; using System; -using Microsoft.Data.SqlClient; using System.IO; using System.Reflection; +using Microsoft.Data.SqlClient; +using Microsoft.SqlServer.Management.Common; +using Microsoft.SqlTools.ServiceLayer.Scripting.Contracts; +using Microsoft.SqlTools.SqlCore.Connection; +using Microsoft.SqlTools.Utility; using static Microsoft.SqlServer.Management.SqlScriptPublish.SqlScriptOptions; namespace Microsoft.SqlTools.ServiceLayer.Scripting diff --git a/src/Microsoft.SqlTools.ServiceLayer/SqlAssessment/GenerateScriptOperation.cs b/src/Microsoft.SqlTools.ServiceLayer/SqlAssessment/GenerateScriptOperation.cs index 95b4a837..3c8d44e0 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/SqlAssessment/GenerateScriptOperation.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/SqlAssessment/GenerateScriptOperation.cs @@ -9,9 +9,9 @@ using System; using System.Globalization; using System.Text; using System.Threading; -using Microsoft.SqlTools.ServiceLayer.Management; using Microsoft.SqlTools.ServiceLayer.SqlAssessment.Contracts; using Microsoft.SqlTools.ServiceLayer.TaskServices; +using Microsoft.SqlTools.SqlCore.Utility; using Microsoft.SqlTools.Utility; namespace Microsoft.SqlTools.ServiceLayer.SqlAssessment @@ -129,7 +129,7 @@ INSERT INTO [dbo].[AssessmentResult] ([CheckName],[CheckId],[RulesetName],[Rules { sb.Append( $@" - ('{CUtils.EscapeStringSQuote(item.DisplayName)}','{CUtils.EscapeStringSQuote(item.CheckId)}','{CUtils.EscapeStringSQuote(item.RulesetName)}','{item.RulesetVersion}','{item.Level}','{CUtils.EscapeStringSQuote(item.Message)}','{CUtils.EscapeStringSQuote(item.TargetName)}','{item.TargetType}','{CUtils.EscapeStringSQuote(item.HelpLink)}','{item.Timestamp:yyyy-MM-dd hh:mm:ss.fff zzz}'),"); + ('{StringUtils.EscapeStringSQuote(item.DisplayName)}','{StringUtils.EscapeStringSQuote(item.CheckId)}','{StringUtils.EscapeStringSQuote(item.RulesetName)}','{item.RulesetVersion}','{item.Level}','{StringUtils.EscapeStringSQuote(item.Message)}','{StringUtils.EscapeStringSQuote(item.TargetName)}','{item.TargetType}','{StringUtils.EscapeStringSQuote(item.HelpLink)}','{item.Timestamp:yyyy-MM-dd hh:mm:ss.fff zzz}'),"); } } diff --git a/src/Microsoft.SqlTools.ServiceLayer/Utility/DatabaseUtils.cs b/src/Microsoft.SqlTools.ServiceLayer/Utility/DatabaseUtils.cs index f02cd27d..41511fa4 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Utility/DatabaseUtils.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Utility/DatabaseUtils.cs @@ -10,6 +10,7 @@ using Microsoft.SqlServer.Management.Dmf; using Microsoft.SqlServer.Management.Sdk.Sfc; using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlTools.ServiceLayer.Management; +using Microsoft.SqlTools.SqlCore.Utility; using System; using System.Collections.Generic; using System.Data; @@ -37,13 +38,13 @@ namespace Microsoft.SqlTools.ServiceLayer.Utility public static string AddStringParameterForInsert(string paramValue) { - string value = string.IsNullOrWhiteSpace(paramValue) ? paramValue : CUtils.EscapeStringSQuote(paramValue); + string value = string.IsNullOrWhiteSpace(paramValue) ? paramValue : StringUtils.EscapeStringSQuote(paramValue); return $"'{value}'"; } public static string AddStringParameterForUpdate(string columnName, string paramValue) { - string value = string.IsNullOrWhiteSpace(paramValue) ? paramValue : CUtils.EscapeStringSQuote(paramValue); + string value = string.IsNullOrWhiteSpace(paramValue) ? paramValue : StringUtils.EscapeStringSQuote(paramValue); return $"{columnName} = N'{value}'"; } diff --git a/src/Microsoft.SqlTools.SqlCore/Connection/AzureAccessToken.cs b/src/Microsoft.SqlTools.SqlCore/Connection/AzureAccessToken.cs new file mode 100644 index 00000000..b4dbbca8 --- /dev/null +++ b/src/Microsoft.SqlTools.SqlCore/Connection/AzureAccessToken.cs @@ -0,0 +1,32 @@ +// +// 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.Common; + +namespace Microsoft.SqlTools.SqlCore.Connection +{ + public class AzureAccessToken : IRenewableToken + { + public DateTimeOffset TokenExpiry { get; set; } + public string Resource { get; set; } + public string Tenant { get; set; } + public string UserId { get; set; } + + private string accessToken; + + public AzureAccessToken(string accessToken) + { + this.accessToken = accessToken; + } + + public string GetAccessToken() + { + return this.accessToken; + } + } +} + + \ No newline at end of file diff --git a/src/Microsoft.SqlTools.ServiceLayer/Connection/Contracts/SecurityToken.cs b/src/Microsoft.SqlTools.SqlCore/Connection/SecurityToken.cs similarity index 88% rename from src/Microsoft.SqlTools.ServiceLayer/Connection/Contracts/SecurityToken.cs rename to src/Microsoft.SqlTools.SqlCore/Connection/SecurityToken.cs index ef4de07e..a06cc235 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Connection/Contracts/SecurityToken.cs +++ b/src/Microsoft.SqlTools.SqlCore/Connection/SecurityToken.cs @@ -3,9 +3,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - -namespace Microsoft.SqlTools.ServiceLayer.Connection.Contracts +namespace Microsoft.SqlTools.SqlCore.Connection { public class SecurityToken { diff --git a/src/Microsoft.SqlTools.SqlCore/Localization/sr.cs b/src/Microsoft.SqlTools.SqlCore/Localization/sr.cs new file mode 100644 index 00000000..23cd31ff --- /dev/null +++ b/src/Microsoft.SqlTools.SqlCore/Localization/sr.cs @@ -0,0 +1,2394 @@ +// WARNING: +// This file was generated by the Microsoft DataWarehouse String Resource Tool 7.0.0.0 +// from information in sr.strings +// DO NOT MODIFY THIS FILE'S CONTENTS, THEY WILL BE OVERWRITTEN +// +namespace Microsoft.SqlTools.SqlCore +{ + using System; + using System.Reflection; + using System.Resources; + using System.Globalization; + + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SR + { + protected SR() + { } + + public static CultureInfo Culture + { + get + { + return Keys.Culture; + } + set + { + Keys.Culture = value; + } + } + + + public static string TreeNodeError + { + get + { + return Keys.GetString(Keys.TreeNodeError); + } + } + + public static string ServerNodeConnectionError + { + get + { + return Keys.GetString(Keys.ServerNodeConnectionError); + } + } + + public static string SchemaHierarchy_Aggregates + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Aggregates); + } + } + + public static string SchemaHierarchy_ServerRoles + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ServerRoles); + } + } + + public static string SchemaHierarchy_ApplicationRoles + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ApplicationRoles); + } + } + + public static string SchemaHierarchy_Assemblies + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Assemblies); + } + } + + public static string SchemaHierarchy_AssemblyFiles + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_AssemblyFiles); + } + } + + public static string SchemaHierarchy_AsymmetricKeys + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_AsymmetricKeys); + } + } + + public static string SchemaHierarchy_DatabaseAsymmetricKeys + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_DatabaseAsymmetricKeys); + } + } + + public static string SchemaHierarchy_DataCompressionOptions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_DataCompressionOptions); + } + } + + public static string SchemaHierarchy_Certificates + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Certificates); + } + } + + public static string SchemaHierarchy_FileTables + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_FileTables); + } + } + + public static string SchemaHierarchy_DatabaseCertificates + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_DatabaseCertificates); + } + } + + public static string SchemaHierarchy_CheckConstraints + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_CheckConstraints); + } + } + + public static string SchemaHierarchy_Columns + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Columns); + } + } + + public static string SchemaHierarchy_Constraints + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Constraints); + } + } + + public static string SchemaHierarchy_Contracts + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Contracts); + } + } + + public static string SchemaHierarchy_Credentials + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Credentials); + } + } + + public static string SchemaHierarchy_ErrorMessages + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ErrorMessages); + } + } + + public static string SchemaHierarchy_ServerRoleMembership + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ServerRoleMembership); + } + } + + public static string SchemaHierarchy_DatabaseOptions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_DatabaseOptions); + } + } + + public static string SchemaHierarchy_DatabaseRoles + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_DatabaseRoles); + } + } + + public static string SchemaHierarchy_RoleMemberships + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_RoleMemberships); + } + } + + public static string SchemaHierarchy_DatabaseTriggers + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_DatabaseTriggers); + } + } + + public static string SchemaHierarchy_DefaultConstraints + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_DefaultConstraints); + } + } + + public static string SchemaHierarchy_Defaults + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Defaults); + } + } + + public static string SchemaHierarchy_Sequences + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Sequences); + } + } + + public static string SchemaHierarchy_Endpoints + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Endpoints); + } + } + + public static string SchemaHierarchy_EventNotifications + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_EventNotifications); + } + } + + public static string SchemaHierarchy_ServerEventNotifications + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ServerEventNotifications); + } + } + + public static string SchemaHierarchy_ExtendedProperties + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ExtendedProperties); + } + } + + public static string SchemaHierarchy_FileGroups + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_FileGroups); + } + } + + public static string SchemaHierarchy_ForeignKeys + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ForeignKeys); + } + } + + public static string SchemaHierarchy_FullTextCatalogs + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_FullTextCatalogs); + } + } + + public static string SchemaHierarchy_FullTextIndexes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_FullTextIndexes); + } + } + + public static string SchemaHierarchy_Functions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Functions); + } + } + + public static string SchemaHierarchy_Indexes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Indexes); + } + } + + public static string SchemaHierarchy_InlineFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_InlineFunctions); + } + } + + public static string SchemaHierarchy_Keys + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Keys); + } + } + + public static string SchemaHierarchy_LinkedServers + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_LinkedServers); + } + } + + public static string SchemaHierarchy_Logins + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Logins); + } + } + + public static string SchemaHierarchy_MasterKey + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_MasterKey); + } + } + + public static string SchemaHierarchy_MasterKeys + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_MasterKeys); + } + } + + public static string SchemaHierarchy_MessageTypes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_MessageTypes); + } + } + + public static string SchemaHierarchy_MultiSelectFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_MultiSelectFunctions); + } + } + + public static string SchemaHierarchy_Parameters + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Parameters); + } + } + + public static string SchemaHierarchy_PartitionFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_PartitionFunctions); + } + } + + public static string SchemaHierarchy_PartitionSchemes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_PartitionSchemes); + } + } + + public static string SchemaHierarchy_Permissions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Permissions); + } + } + + public static string SchemaHierarchy_PrimaryKeys + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_PrimaryKeys); + } + } + + public static string SchemaHierarchy_Programmability + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Programmability); + } + } + + public static string SchemaHierarchy_Queues + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Queues); + } + } + + public static string SchemaHierarchy_RemoteServiceBindings + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_RemoteServiceBindings); + } + } + + public static string SchemaHierarchy_ReturnedColumns + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ReturnedColumns); + } + } + + public static string SchemaHierarchy_Roles + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Roles); + } + } + + public static string SchemaHierarchy_Routes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Routes); + } + } + + public static string SchemaHierarchy_Rules + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Rules); + } + } + + public static string SchemaHierarchy_Schemas + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Schemas); + } + } + + public static string SchemaHierarchy_BuiltInSchema + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_BuiltInSchema); + } + } + + public static string SchemaHierarchy_Security + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Security); + } + } + + public static string SchemaHierarchy_ServerObjects + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ServerObjects); + } + } + + public static string SchemaHierarchy_Management + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Management); + } + } + + public static string SchemaHierarchy_ServerTriggers + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ServerTriggers); + } + } + + public static string SchemaHierarchy_ServiceBroker + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ServiceBroker); + } + } + + public static string SchemaHierarchy_Services + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Services); + } + } + + public static string SchemaHierarchy_Signatures + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Signatures); + } + } + + public static string SchemaHierarchy_LogFiles + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_LogFiles); + } + } + + public static string SchemaHierarchy_Statistics + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Statistics); + } + } + + public static string SchemaHierarchy_Storage + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Storage); + } + } + + public static string SchemaHierarchy_StoredProcedures + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_StoredProcedures); + } + } + + public static string SchemaHierarchy_SymmetricKeys + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SymmetricKeys); + } + } + + public static string SchemaHierarchy_Synonyms + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Synonyms); + } + } + + public static string SchemaHierarchy_Tables + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Tables); + } + } + + public static string SchemaHierarchy_Triggers + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Triggers); + } + } + + public static string SchemaHierarchy_Types + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Types); + } + } + + public static string SchemaHierarchy_UniqueKeys + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_UniqueKeys); + } + } + + public static string SchemaHierarchy_UserDefinedDataTypes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_UserDefinedDataTypes); + } + } + + public static string SchemaHierarchy_UserDefinedTypes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_UserDefinedTypes); + } + } + + public static string SchemaHierarchy_Users + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Users); + } + } + + public static string SchemaHierarchy_Views + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Views); + } + } + + public static string SchemaHierarchy_XmlIndexes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_XmlIndexes); + } + } + + public static string SchemaHierarchy_XMLSchemaCollections + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_XMLSchemaCollections); + } + } + + public static string SchemaHierarchy_UserDefinedTableTypes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_UserDefinedTableTypes); + } + } + + public static string SchemaHierarchy_FilegroupFiles + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_FilegroupFiles); + } + } + + public static string MissingCaption + { + get + { + return Keys.GetString(Keys.MissingCaption); + } + } + + public static string SchemaHierarchy_BrokerPriorities + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_BrokerPriorities); + } + } + + public static string SchemaHierarchy_CryptographicProviders + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_CryptographicProviders); + } + } + + public static string SchemaHierarchy_DatabaseAuditSpecifications + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_DatabaseAuditSpecifications); + } + } + + public static string SchemaHierarchy_DatabaseEncryptionKeys + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_DatabaseEncryptionKeys); + } + } + + public static string SchemaHierarchy_EventSessions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_EventSessions); + } + } + + public static string SchemaHierarchy_FullTextStopLists + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_FullTextStopLists); + } + } + + public static string SchemaHierarchy_ResourcePools + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ResourcePools); + } + } + + public static string SchemaHierarchy_ServerAudits + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ServerAudits); + } + } + + public static string SchemaHierarchy_ServerAuditSpecifications + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ServerAuditSpecifications); + } + } + + public static string SchemaHierarchy_SpatialIndexes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SpatialIndexes); + } + } + + public static string SchemaHierarchy_WorkloadGroups + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_WorkloadGroups); + } + } + + public static string SchemaHierarchy_SqlFiles + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SqlFiles); + } + } + + public static string SchemaHierarchy_ServerFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ServerFunctions); + } + } + + public static string SchemaHierarchy_SqlType + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SqlType); + } + } + + public static string SchemaHierarchy_ServerOptions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ServerOptions); + } + } + + public static string SchemaHierarchy_DatabaseDiagrams + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_DatabaseDiagrams); + } + } + + public static string SchemaHierarchy_SystemTables + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemTables); + } + } + + public static string SchemaHierarchy_Databases + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Databases); + } + } + + public static string SchemaHierarchy_SystemContracts + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemContracts); + } + } + + public static string SchemaHierarchy_SystemDatabases + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemDatabases); + } + } + + public static string SchemaHierarchy_SystemMessageTypes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemMessageTypes); + } + } + + public static string SchemaHierarchy_SystemQueues + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemQueues); + } + } + + public static string SchemaHierarchy_SystemServices + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemServices); + } + } + + public static string SchemaHierarchy_SystemStoredProcedures + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemStoredProcedures); + } + } + + public static string SchemaHierarchy_SystemViews + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemViews); + } + } + + public static string SchemaHierarchy_DataTierApplications + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_DataTierApplications); + } + } + + public static string SchemaHierarchy_ExtendedStoredProcedures + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ExtendedStoredProcedures); + } + } + + public static string SchemaHierarchy_SystemAggregateFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemAggregateFunctions); + } + } + + public static string SchemaHierarchy_SystemApproximateNumerics + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemApproximateNumerics); + } + } + + public static string SchemaHierarchy_SystemBinaryStrings + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemBinaryStrings); + } + } + + public static string SchemaHierarchy_SystemCharacterStrings + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemCharacterStrings); + } + } + + public static string SchemaHierarchy_SystemCLRDataTypes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemCLRDataTypes); + } + } + + public static string SchemaHierarchy_SystemConfigurationFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemConfigurationFunctions); + } + } + + public static string SchemaHierarchy_SystemCursorFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemCursorFunctions); + } + } + + public static string SchemaHierarchy_SystemDataTypes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemDataTypes); + } + } + + public static string SchemaHierarchy_SystemDateAndTime + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemDateAndTime); + } + } + + public static string SchemaHierarchy_SystemDateAndTimeFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemDateAndTimeFunctions); + } + } + + public static string SchemaHierarchy_SystemExactNumerics + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemExactNumerics); + } + } + + public static string SchemaHierarchy_SystemFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemFunctions); + } + } + + public static string SchemaHierarchy_SystemHierarchyIdFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemHierarchyIdFunctions); + } + } + + public static string SchemaHierarchy_SystemMathematicalFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemMathematicalFunctions); + } + } + + public static string SchemaHierarchy_SystemMetadataFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemMetadataFunctions); + } + } + + public static string SchemaHierarchy_SystemOtherDataTypes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemOtherDataTypes); + } + } + + public static string SchemaHierarchy_SystemOtherFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemOtherFunctions); + } + } + + public static string SchemaHierarchy_SystemRowsetFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemRowsetFunctions); + } + } + + public static string SchemaHierarchy_SystemSecurityFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemSecurityFunctions); + } + } + + public static string SchemaHierarchy_SystemSpatialDataTypes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemSpatialDataTypes); + } + } + + public static string SchemaHierarchy_SystemStringFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemStringFunctions); + } + } + + public static string SchemaHierarchy_SystemSystemStatisticalFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemSystemStatisticalFunctions); + } + } + + public static string SchemaHierarchy_SystemTextAndImageFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemTextAndImageFunctions); + } + } + + public static string SchemaHierarchy_SystemUnicodeCharacterStrings + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemUnicodeCharacterStrings); + } + } + + public static string SchemaHierarchy_AggregateFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_AggregateFunctions); + } + } + + public static string SchemaHierarchy_ScalarValuedFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ScalarValuedFunctions); + } + } + + public static string SchemaHierarchy_TableValuedFunctions + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_TableValuedFunctions); + } + } + + public static string SchemaHierarchy_SystemExtendedStoredProcedures + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SystemExtendedStoredProcedures); + } + } + + public static string SchemaHierarchy_BuiltInType + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_BuiltInType); + } + } + + public static string SchemaHierarchy_BuiltInServerRole + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_BuiltInServerRole); + } + } + + public static string SchemaHierarchy_UserWithPassword + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_UserWithPassword); + } + } + + public static string SchemaHierarchy_SearchPropertyList + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SearchPropertyList); + } + } + + public static string SchemaHierarchy_SecurityPolicies + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SecurityPolicies); + } + } + + public static string SchemaHierarchy_SecurityPredicates + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SecurityPredicates); + } + } + + public static string SchemaHierarchy_ServerRole + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ServerRole); + } + } + + public static string SchemaHierarchy_SearchPropertyLists + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SearchPropertyLists); + } + } + + public static string SchemaHierarchy_ColumnStoreIndexes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ColumnStoreIndexes); + } + } + + public static string SchemaHierarchy_TableTypeIndexes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_TableTypeIndexes); + } + } + + public static string SchemaHierarchy_Server + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_Server); + } + } + + public static string SchemaHierarchy_SelectiveXmlIndexes + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SelectiveXmlIndexes); + } + } + + public static string SchemaHierarchy_XmlNamespaces + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_XmlNamespaces); + } + } + + public static string SchemaHierarchy_XmlTypedPromotedPaths + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_XmlTypedPromotedPaths); + } + } + + public static string SchemaHierarchy_SqlTypedPromotedPaths + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SqlTypedPromotedPaths); + } + } + + public static string SchemaHierarchy_DatabaseScopedCredentials + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_DatabaseScopedCredentials); + } + } + + public static string SchemaHierarchy_ExternalDataSources + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ExternalDataSources); + } + } + + public static string SchemaHierarchy_ExternalFileFormats + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ExternalFileFormats); + } + } + + public static string SchemaHierarchy_ExternalResources + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ExternalResources); + } + } + + public static string SchemaHierarchy_ExternalTables + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ExternalTables); + } + } + + public static string SchemaHierarchy_DroppedLedgerColumns + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_DroppedLedgerColumns); + } + } + + public static string SchemaHierarchy_DroppedLedgerTables + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_DroppedLedgerTables); + } + } + + public static string SchemaHierarchy_DroppedLedgerViews + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_DroppedLedgerViews); + } + } + + public static string SchemaHierarchy_AlwaysEncryptedKeys + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_AlwaysEncryptedKeys); + } + } + + public static string SchemaHierarchy_ColumnMasterKeys + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ColumnMasterKeys); + } + } + + public static string SchemaHierarchy_ColumnEncryptionKeys + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ColumnEncryptionKeys); + } + } + + public static string SchemaHierarchy_SubroutineParameterLabelFormatString + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SubroutineParameterLabelFormatString); + } + } + + public static string SchemaHierarchy_SubroutineParameterNoDefaultLabel + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SubroutineParameterNoDefaultLabel); + } + } + + public static string SchemaHierarchy_SubroutineParameterInputLabel + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SubroutineParameterInputLabel); + } + } + + public static string SchemaHierarchy_SubroutineParameterInputOutputLabel + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SubroutineParameterInputOutputLabel); + } + } + + public static string SchemaHierarchy_SubroutineParameterInputReadOnlyLabel + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SubroutineParameterInputReadOnlyLabel); + } + } + + public static string SchemaHierarchy_SubroutineParameterInputOutputReadOnlyLabel + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SubroutineParameterInputOutputReadOnlyLabel); + } + } + + public static string SchemaHierarchy_SubroutineParameterDefaultLabel + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_SubroutineParameterDefaultLabel); + } + } + + public static string SchemaHierarchy_NullColumn_Label + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_NullColumn_Label); + } + } + + public static string SchemaHierarchy_NotNullColumn_Label + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_NotNullColumn_Label); + } + } + + public static string SchemaHierarchy_UDDTLabelWithType + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_UDDTLabelWithType); + } + } + + public static string SchemaHierarchy_UDDTLabelWithoutType + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_UDDTLabelWithoutType); + } + } + + public static string SchemaHierarchy_ComputedColumnLabelWithType + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ComputedColumnLabelWithType); + } + } + + public static string SchemaHierarchy_ComputedColumnLabelWithoutType + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ComputedColumnLabelWithoutType); + } + } + + public static string SchemaHierarchy_ColumnSetLabelWithoutType + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ColumnSetLabelWithoutType); + } + } + + public static string SchemaHierarchy_ColumnSetLabelWithType + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ColumnSetLabelWithType); + } + } + + public static string SchemaHierarchy_ColumnSetLabelWithTypeAndKeyString + { + get + { + return Keys.GetString(Keys.SchemaHierarchy_ColumnSetLabelWithTypeAndKeyString); + } + } + + public static string UniqueIndex_LabelPart + { + get + { + return Keys.GetString(Keys.UniqueIndex_LabelPart); + } + } + + public static string NonUniqueIndex_LabelPart + { + get + { + return Keys.GetString(Keys.NonUniqueIndex_LabelPart); + } + } + + public static string ClusteredIndex_LabelPart + { + get + { + return Keys.GetString(Keys.ClusteredIndex_LabelPart); + } + } + + public static string NonClusteredIndex_LabelPart + { + get + { + return Keys.GetString(Keys.NonClusteredIndex_LabelPart); + } + } + + public static string History_LabelPart + { + get + { + return Keys.GetString(Keys.History_LabelPart); + } + } + + public static string SystemVersioned_LabelPart + { + get + { + return Keys.GetString(Keys.SystemVersioned_LabelPart); + } + } + + public static string UpdatableLedger_LabelPart + { + get + { + return Keys.GetString(Keys.UpdatableLedger_LabelPart); + } + } + + public static string AppendOnlyLedger_LabelPart + { + get + { + return Keys.GetString(Keys.AppendOnlyLedger_LabelPart); + } + } + + public static string Ledger_LabelPart + { + get + { + return Keys.GetString(Keys.Ledger_LabelPart); + } + } + + public static string External_LabelPart + { + get + { + return Keys.GetString(Keys.External_LabelPart); + } + } + + public static string FileTable_LabelPart + { + get + { + return Keys.GetString(Keys.FileTable_LabelPart); + } + } + + public static string DatabaseNotAccessible + { + get + { + return Keys.GetString(Keys.DatabaseNotAccessible); + } + } + + public static string FilterName + { + get + { + return Keys.GetString(Keys.FilterName); + } + } + + public static string FilterNameDescription + { + get + { + return Keys.GetString(Keys.FilterNameDescription); + } + } + + public static string FilterSchema + { + get + { + return Keys.GetString(Keys.FilterSchema); + } + } + + public static string FilterSchemaDescription + { + get + { + return Keys.GetString(Keys.FilterSchemaDescription); + } + } + + public static string FilterOwner + { + get + { + return Keys.GetString(Keys.FilterOwner); + } + } + + public static string FilterOwnerDescription + { + get + { + return Keys.GetString(Keys.FilterOwnerDescription); + } + } + + public static string FilterDurabilityType + { + get + { + return Keys.GetString(Keys.FilterDurabilityType); + } + } + + public static string FilterDurabilityTypeDescription + { + get + { + return Keys.GetString(Keys.FilterDurabilityTypeDescription); + } + } + + public static string FilterDurabilitySchemaOnly + { + get + { + return Keys.GetString(Keys.FilterDurabilitySchemaOnly); + } + } + + public static string FilterDurabilitySchemaAndData + { + get + { + return Keys.GetString(Keys.FilterDurabilitySchemaAndData); + } + } + + public static string FilterIsMemoryOptimized + { + get + { + return Keys.GetString(Keys.FilterIsMemoryOptimized); + } + } + + public static string FilterIsMemoryOptimizedDescription + { + get + { + return Keys.GetString(Keys.FilterIsMemoryOptimizedDescription); + } + } + + public static string FilterCreateDate + { + get + { + return Keys.GetString(Keys.FilterCreateDate); + } + } + + public static string FilterCreateDateDescription + { + get + { + return Keys.GetString(Keys.FilterCreateDateDescription); + } + } + + public static string FilterIsNativelyCompiled + { + get + { + return Keys.GetString(Keys.FilterIsNativelyCompiled); + } + } + + public static string FilterIsNativelyCompiledDescription + { + get + { + return Keys.GetString(Keys.FilterIsNativelyCompiledDescription); + } + } + + public static string FilterInPrimaryKey + { + get + { + return Keys.GetString(Keys.FilterInPrimaryKey); + } + } + + public static string FilterInPrimaryKeyDescription + { + get + { + return Keys.GetString(Keys.FilterInPrimaryKeyDescription); + } + } + + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Keys + { + static ResourceManager resourceManager = new ResourceManager("Microsoft.SqlTools.SqlCore.Localization.SR", typeof(SR).GetTypeInfo().Assembly); + + static CultureInfo _culture = null; + + + public const string TreeNodeError = "TreeNodeError"; + + + public const string ServerNodeConnectionError = "ServerNodeConnectionError"; + + + public const string SchemaHierarchy_Aggregates = "SchemaHierarchy_Aggregates"; + + + public const string SchemaHierarchy_ServerRoles = "SchemaHierarchy_ServerRoles"; + + + public const string SchemaHierarchy_ApplicationRoles = "SchemaHierarchy_ApplicationRoles"; + + + public const string SchemaHierarchy_Assemblies = "SchemaHierarchy_Assemblies"; + + + public const string SchemaHierarchy_AssemblyFiles = "SchemaHierarchy_AssemblyFiles"; + + + public const string SchemaHierarchy_AsymmetricKeys = "SchemaHierarchy_AsymmetricKeys"; + + + public const string SchemaHierarchy_DatabaseAsymmetricKeys = "SchemaHierarchy_DatabaseAsymmetricKeys"; + + + public const string SchemaHierarchy_DataCompressionOptions = "SchemaHierarchy_DataCompressionOptions"; + + + public const string SchemaHierarchy_Certificates = "SchemaHierarchy_Certificates"; + + + public const string SchemaHierarchy_FileTables = "SchemaHierarchy_FileTables"; + + + public const string SchemaHierarchy_DatabaseCertificates = "SchemaHierarchy_DatabaseCertificates"; + + + public const string SchemaHierarchy_CheckConstraints = "SchemaHierarchy_CheckConstraints"; + + + public const string SchemaHierarchy_Columns = "SchemaHierarchy_Columns"; + + + public const string SchemaHierarchy_Constraints = "SchemaHierarchy_Constraints"; + + + public const string SchemaHierarchy_Contracts = "SchemaHierarchy_Contracts"; + + + public const string SchemaHierarchy_Credentials = "SchemaHierarchy_Credentials"; + + + public const string SchemaHierarchy_ErrorMessages = "SchemaHierarchy_ErrorMessages"; + + + public const string SchemaHierarchy_ServerRoleMembership = "SchemaHierarchy_ServerRoleMembership"; + + + public const string SchemaHierarchy_DatabaseOptions = "SchemaHierarchy_DatabaseOptions"; + + + public const string SchemaHierarchy_DatabaseRoles = "SchemaHierarchy_DatabaseRoles"; + + + public const string SchemaHierarchy_RoleMemberships = "SchemaHierarchy_RoleMemberships"; + + + public const string SchemaHierarchy_DatabaseTriggers = "SchemaHierarchy_DatabaseTriggers"; + + + public const string SchemaHierarchy_DefaultConstraints = "SchemaHierarchy_DefaultConstraints"; + + + public const string SchemaHierarchy_Defaults = "SchemaHierarchy_Defaults"; + + + public const string SchemaHierarchy_Sequences = "SchemaHierarchy_Sequences"; + + + public const string SchemaHierarchy_Endpoints = "SchemaHierarchy_Endpoints"; + + + public const string SchemaHierarchy_EventNotifications = "SchemaHierarchy_EventNotifications"; + + + public const string SchemaHierarchy_ServerEventNotifications = "SchemaHierarchy_ServerEventNotifications"; + + + public const string SchemaHierarchy_ExtendedProperties = "SchemaHierarchy_ExtendedProperties"; + + + public const string SchemaHierarchy_FileGroups = "SchemaHierarchy_FileGroups"; + + + public const string SchemaHierarchy_ForeignKeys = "SchemaHierarchy_ForeignKeys"; + + + public const string SchemaHierarchy_FullTextCatalogs = "SchemaHierarchy_FullTextCatalogs"; + + + public const string SchemaHierarchy_FullTextIndexes = "SchemaHierarchy_FullTextIndexes"; + + + public const string SchemaHierarchy_Functions = "SchemaHierarchy_Functions"; + + + public const string SchemaHierarchy_Indexes = "SchemaHierarchy_Indexes"; + + + public const string SchemaHierarchy_InlineFunctions = "SchemaHierarchy_InlineFunctions"; + + + public const string SchemaHierarchy_Keys = "SchemaHierarchy_Keys"; + + + public const string SchemaHierarchy_LinkedServers = "SchemaHierarchy_LinkedServers"; + + + public const string SchemaHierarchy_Logins = "SchemaHierarchy_Logins"; + + + public const string SchemaHierarchy_MasterKey = "SchemaHierarchy_MasterKey"; + + + public const string SchemaHierarchy_MasterKeys = "SchemaHierarchy_MasterKeys"; + + + public const string SchemaHierarchy_MessageTypes = "SchemaHierarchy_MessageTypes"; + + + public const string SchemaHierarchy_MultiSelectFunctions = "SchemaHierarchy_MultiSelectFunctions"; + + + public const string SchemaHierarchy_Parameters = "SchemaHierarchy_Parameters"; + + + public const string SchemaHierarchy_PartitionFunctions = "SchemaHierarchy_PartitionFunctions"; + + + public const string SchemaHierarchy_PartitionSchemes = "SchemaHierarchy_PartitionSchemes"; + + + public const string SchemaHierarchy_Permissions = "SchemaHierarchy_Permissions"; + + + public const string SchemaHierarchy_PrimaryKeys = "SchemaHierarchy_PrimaryKeys"; + + + public const string SchemaHierarchy_Programmability = "SchemaHierarchy_Programmability"; + + + public const string SchemaHierarchy_Queues = "SchemaHierarchy_Queues"; + + + public const string SchemaHierarchy_RemoteServiceBindings = "SchemaHierarchy_RemoteServiceBindings"; + + + public const string SchemaHierarchy_ReturnedColumns = "SchemaHierarchy_ReturnedColumns"; + + + public const string SchemaHierarchy_Roles = "SchemaHierarchy_Roles"; + + + public const string SchemaHierarchy_Routes = "SchemaHierarchy_Routes"; + + + public const string SchemaHierarchy_Rules = "SchemaHierarchy_Rules"; + + + public const string SchemaHierarchy_Schemas = "SchemaHierarchy_Schemas"; + + + public const string SchemaHierarchy_BuiltInSchema = "SchemaHierarchy_BuiltInSchema"; + + + public const string SchemaHierarchy_Security = "SchemaHierarchy_Security"; + + + public const string SchemaHierarchy_ServerObjects = "SchemaHierarchy_ServerObjects"; + + + public const string SchemaHierarchy_Management = "SchemaHierarchy_Management"; + + + public const string SchemaHierarchy_ServerTriggers = "SchemaHierarchy_ServerTriggers"; + + + public const string SchemaHierarchy_ServiceBroker = "SchemaHierarchy_ServiceBroker"; + + + public const string SchemaHierarchy_Services = "SchemaHierarchy_Services"; + + + public const string SchemaHierarchy_Signatures = "SchemaHierarchy_Signatures"; + + + public const string SchemaHierarchy_LogFiles = "SchemaHierarchy_LogFiles"; + + + public const string SchemaHierarchy_Statistics = "SchemaHierarchy_Statistics"; + + + public const string SchemaHierarchy_Storage = "SchemaHierarchy_Storage"; + + + public const string SchemaHierarchy_StoredProcedures = "SchemaHierarchy_StoredProcedures"; + + + public const string SchemaHierarchy_SymmetricKeys = "SchemaHierarchy_SymmetricKeys"; + + + public const string SchemaHierarchy_Synonyms = "SchemaHierarchy_Synonyms"; + + + public const string SchemaHierarchy_Tables = "SchemaHierarchy_Tables"; + + + public const string SchemaHierarchy_Triggers = "SchemaHierarchy_Triggers"; + + + public const string SchemaHierarchy_Types = "SchemaHierarchy_Types"; + + + public const string SchemaHierarchy_UniqueKeys = "SchemaHierarchy_UniqueKeys"; + + + public const string SchemaHierarchy_UserDefinedDataTypes = "SchemaHierarchy_UserDefinedDataTypes"; + + + public const string SchemaHierarchy_UserDefinedTypes = "SchemaHierarchy_UserDefinedTypes"; + + + public const string SchemaHierarchy_Users = "SchemaHierarchy_Users"; + + + public const string SchemaHierarchy_Views = "SchemaHierarchy_Views"; + + + public const string SchemaHierarchy_XmlIndexes = "SchemaHierarchy_XmlIndexes"; + + + public const string SchemaHierarchy_XMLSchemaCollections = "SchemaHierarchy_XMLSchemaCollections"; + + + public const string SchemaHierarchy_UserDefinedTableTypes = "SchemaHierarchy_UserDefinedTableTypes"; + + + public const string SchemaHierarchy_FilegroupFiles = "SchemaHierarchy_FilegroupFiles"; + + + public const string MissingCaption = "MissingCaption"; + + + public const string SchemaHierarchy_BrokerPriorities = "SchemaHierarchy_BrokerPriorities"; + + + public const string SchemaHierarchy_CryptographicProviders = "SchemaHierarchy_CryptographicProviders"; + + + public const string SchemaHierarchy_DatabaseAuditSpecifications = "SchemaHierarchy_DatabaseAuditSpecifications"; + + + public const string SchemaHierarchy_DatabaseEncryptionKeys = "SchemaHierarchy_DatabaseEncryptionKeys"; + + + public const string SchemaHierarchy_EventSessions = "SchemaHierarchy_EventSessions"; + + + public const string SchemaHierarchy_FullTextStopLists = "SchemaHierarchy_FullTextStopLists"; + + + public const string SchemaHierarchy_ResourcePools = "SchemaHierarchy_ResourcePools"; + + + public const string SchemaHierarchy_ServerAudits = "SchemaHierarchy_ServerAudits"; + + + public const string SchemaHierarchy_ServerAuditSpecifications = "SchemaHierarchy_ServerAuditSpecifications"; + + + public const string SchemaHierarchy_SpatialIndexes = "SchemaHierarchy_SpatialIndexes"; + + + public const string SchemaHierarchy_WorkloadGroups = "SchemaHierarchy_WorkloadGroups"; + + + public const string SchemaHierarchy_SqlFiles = "SchemaHierarchy_SqlFiles"; + + + public const string SchemaHierarchy_ServerFunctions = "SchemaHierarchy_ServerFunctions"; + + + public const string SchemaHierarchy_SqlType = "SchemaHierarchy_SqlType"; + + + public const string SchemaHierarchy_ServerOptions = "SchemaHierarchy_ServerOptions"; + + + public const string SchemaHierarchy_DatabaseDiagrams = "SchemaHierarchy_DatabaseDiagrams"; + + + public const string SchemaHierarchy_SystemTables = "SchemaHierarchy_SystemTables"; + + + public const string SchemaHierarchy_Databases = "SchemaHierarchy_Databases"; + + + public const string SchemaHierarchy_SystemContracts = "SchemaHierarchy_SystemContracts"; + + + public const string SchemaHierarchy_SystemDatabases = "SchemaHierarchy_SystemDatabases"; + + + public const string SchemaHierarchy_SystemMessageTypes = "SchemaHierarchy_SystemMessageTypes"; + + + public const string SchemaHierarchy_SystemQueues = "SchemaHierarchy_SystemQueues"; + + + public const string SchemaHierarchy_SystemServices = "SchemaHierarchy_SystemServices"; + + + public const string SchemaHierarchy_SystemStoredProcedures = "SchemaHierarchy_SystemStoredProcedures"; + + + public const string SchemaHierarchy_SystemViews = "SchemaHierarchy_SystemViews"; + + + public const string SchemaHierarchy_DataTierApplications = "SchemaHierarchy_DataTierApplications"; + + + public const string SchemaHierarchy_ExtendedStoredProcedures = "SchemaHierarchy_ExtendedStoredProcedures"; + + + public const string SchemaHierarchy_SystemAggregateFunctions = "SchemaHierarchy_SystemAggregateFunctions"; + + + public const string SchemaHierarchy_SystemApproximateNumerics = "SchemaHierarchy_SystemApproximateNumerics"; + + + public const string SchemaHierarchy_SystemBinaryStrings = "SchemaHierarchy_SystemBinaryStrings"; + + + public const string SchemaHierarchy_SystemCharacterStrings = "SchemaHierarchy_SystemCharacterStrings"; + + + public const string SchemaHierarchy_SystemCLRDataTypes = "SchemaHierarchy_SystemCLRDataTypes"; + + + public const string SchemaHierarchy_SystemConfigurationFunctions = "SchemaHierarchy_SystemConfigurationFunctions"; + + + public const string SchemaHierarchy_SystemCursorFunctions = "SchemaHierarchy_SystemCursorFunctions"; + + + public const string SchemaHierarchy_SystemDataTypes = "SchemaHierarchy_SystemDataTypes"; + + + public const string SchemaHierarchy_SystemDateAndTime = "SchemaHierarchy_SystemDateAndTime"; + + + public const string SchemaHierarchy_SystemDateAndTimeFunctions = "SchemaHierarchy_SystemDateAndTimeFunctions"; + + + public const string SchemaHierarchy_SystemExactNumerics = "SchemaHierarchy_SystemExactNumerics"; + + + public const string SchemaHierarchy_SystemFunctions = "SchemaHierarchy_SystemFunctions"; + + + public const string SchemaHierarchy_SystemHierarchyIdFunctions = "SchemaHierarchy_SystemHierarchyIdFunctions"; + + + public const string SchemaHierarchy_SystemMathematicalFunctions = "SchemaHierarchy_SystemMathematicalFunctions"; + + + public const string SchemaHierarchy_SystemMetadataFunctions = "SchemaHierarchy_SystemMetadataFunctions"; + + + public const string SchemaHierarchy_SystemOtherDataTypes = "SchemaHierarchy_SystemOtherDataTypes"; + + + public const string SchemaHierarchy_SystemOtherFunctions = "SchemaHierarchy_SystemOtherFunctions"; + + + public const string SchemaHierarchy_SystemRowsetFunctions = "SchemaHierarchy_SystemRowsetFunctions"; + + + public const string SchemaHierarchy_SystemSecurityFunctions = "SchemaHierarchy_SystemSecurityFunctions"; + + + public const string SchemaHierarchy_SystemSpatialDataTypes = "SchemaHierarchy_SystemSpatialDataTypes"; + + + public const string SchemaHierarchy_SystemStringFunctions = "SchemaHierarchy_SystemStringFunctions"; + + + public const string SchemaHierarchy_SystemSystemStatisticalFunctions = "SchemaHierarchy_SystemSystemStatisticalFunctions"; + + + public const string SchemaHierarchy_SystemTextAndImageFunctions = "SchemaHierarchy_SystemTextAndImageFunctions"; + + + public const string SchemaHierarchy_SystemUnicodeCharacterStrings = "SchemaHierarchy_SystemUnicodeCharacterStrings"; + + + public const string SchemaHierarchy_AggregateFunctions = "SchemaHierarchy_AggregateFunctions"; + + + public const string SchemaHierarchy_ScalarValuedFunctions = "SchemaHierarchy_ScalarValuedFunctions"; + + + public const string SchemaHierarchy_TableValuedFunctions = "SchemaHierarchy_TableValuedFunctions"; + + + public const string SchemaHierarchy_SystemExtendedStoredProcedures = "SchemaHierarchy_SystemExtendedStoredProcedures"; + + + public const string SchemaHierarchy_BuiltInType = "SchemaHierarchy_BuiltInType"; + + + public const string SchemaHierarchy_BuiltInServerRole = "SchemaHierarchy_BuiltInServerRole"; + + + public const string SchemaHierarchy_UserWithPassword = "SchemaHierarchy_UserWithPassword"; + + + public const string SchemaHierarchy_SearchPropertyList = "SchemaHierarchy_SearchPropertyList"; + + + public const string SchemaHierarchy_SecurityPolicies = "SchemaHierarchy_SecurityPolicies"; + + + public const string SchemaHierarchy_SecurityPredicates = "SchemaHierarchy_SecurityPredicates"; + + + public const string SchemaHierarchy_ServerRole = "SchemaHierarchy_ServerRole"; + + + public const string SchemaHierarchy_SearchPropertyLists = "SchemaHierarchy_SearchPropertyLists"; + + + public const string SchemaHierarchy_ColumnStoreIndexes = "SchemaHierarchy_ColumnStoreIndexes"; + + + public const string SchemaHierarchy_TableTypeIndexes = "SchemaHierarchy_TableTypeIndexes"; + + + public const string SchemaHierarchy_Server = "SchemaHierarchy_Server"; + + + public const string SchemaHierarchy_SelectiveXmlIndexes = "SchemaHierarchy_SelectiveXmlIndexes"; + + + public const string SchemaHierarchy_XmlNamespaces = "SchemaHierarchy_XmlNamespaces"; + + + public const string SchemaHierarchy_XmlTypedPromotedPaths = "SchemaHierarchy_XmlTypedPromotedPaths"; + + + public const string SchemaHierarchy_SqlTypedPromotedPaths = "SchemaHierarchy_SqlTypedPromotedPaths"; + + + public const string SchemaHierarchy_DatabaseScopedCredentials = "SchemaHierarchy_DatabaseScopedCredentials"; + + + public const string SchemaHierarchy_ExternalDataSources = "SchemaHierarchy_ExternalDataSources"; + + + public const string SchemaHierarchy_ExternalFileFormats = "SchemaHierarchy_ExternalFileFormats"; + + + public const string SchemaHierarchy_ExternalResources = "SchemaHierarchy_ExternalResources"; + + + public const string SchemaHierarchy_ExternalTables = "SchemaHierarchy_ExternalTables"; + + + public const string SchemaHierarchy_DroppedLedgerColumns = "SchemaHierarchy_DroppedLedgerColumns"; + + + public const string SchemaHierarchy_DroppedLedgerTables = "SchemaHierarchy_DroppedLedgerTables"; + + + public const string SchemaHierarchy_DroppedLedgerViews = "SchemaHierarchy_DroppedLedgerViews"; + + + public const string SchemaHierarchy_AlwaysEncryptedKeys = "SchemaHierarchy_AlwaysEncryptedKeys"; + + + public const string SchemaHierarchy_ColumnMasterKeys = "SchemaHierarchy_ColumnMasterKeys"; + + + public const string SchemaHierarchy_ColumnEncryptionKeys = "SchemaHierarchy_ColumnEncryptionKeys"; + + + public const string SchemaHierarchy_SubroutineParameterLabelFormatString = "SchemaHierarchy_SubroutineParameterLabelFormatString"; + + + public const string SchemaHierarchy_SubroutineParameterNoDefaultLabel = "SchemaHierarchy_SubroutineParameterNoDefaultLabel"; + + + public const string SchemaHierarchy_SubroutineParameterInputLabel = "SchemaHierarchy_SubroutineParameterInputLabel"; + + + public const string SchemaHierarchy_SubroutineParameterInputOutputLabel = "SchemaHierarchy_SubroutineParameterInputOutputLabel"; + + + public const string SchemaHierarchy_SubroutineParameterInputReadOnlyLabel = "SchemaHierarchy_SubroutineParameterInputReadOnlyLabel"; + + + public const string SchemaHierarchy_SubroutineParameterInputOutputReadOnlyLabel = "SchemaHierarchy_SubroutineParameterInputOutputReadOnlyLabel"; + + + public const string SchemaHierarchy_SubroutineParameterDefaultLabel = "SchemaHierarchy_SubroutineParameterDefaultLabel"; + + + public const string SchemaHierarchy_NullColumn_Label = "SchemaHierarchy_NullColumn_Label"; + + + public const string SchemaHierarchy_NotNullColumn_Label = "SchemaHierarchy_NotNullColumn_Label"; + + + public const string SchemaHierarchy_UDDTLabelWithType = "SchemaHierarchy_UDDTLabelWithType"; + + + public const string SchemaHierarchy_UDDTLabelWithoutType = "SchemaHierarchy_UDDTLabelWithoutType"; + + + public const string SchemaHierarchy_ComputedColumnLabelWithType = "SchemaHierarchy_ComputedColumnLabelWithType"; + + + public const string SchemaHierarchy_ComputedColumnLabelWithoutType = "SchemaHierarchy_ComputedColumnLabelWithoutType"; + + + public const string SchemaHierarchy_ColumnSetLabelWithoutType = "SchemaHierarchy_ColumnSetLabelWithoutType"; + + + public const string SchemaHierarchy_ColumnSetLabelWithType = "SchemaHierarchy_ColumnSetLabelWithType"; + + + public const string SchemaHierarchy_ColumnSetLabelWithTypeAndKeyString = "SchemaHierarchy_ColumnSetLabelWithTypeAndKeyString"; + + + public const string UniqueIndex_LabelPart = "UniqueIndex_LabelPart"; + + + public const string NonUniqueIndex_LabelPart = "NonUniqueIndex_LabelPart"; + + + public const string ClusteredIndex_LabelPart = "ClusteredIndex_LabelPart"; + + + public const string NonClusteredIndex_LabelPart = "NonClusteredIndex_LabelPart"; + + + public const string History_LabelPart = "History_LabelPart"; + + + public const string SystemVersioned_LabelPart = "SystemVersioned_LabelPart"; + + + public const string UpdatableLedger_LabelPart = "UpdatableLedger_LabelPart"; + + + public const string AppendOnlyLedger_LabelPart = "AppendOnlyLedger_LabelPart"; + + + public const string Ledger_LabelPart = "Ledger_LabelPart"; + + + public const string External_LabelPart = "External_LabelPart"; + + + public const string FileTable_LabelPart = "FileTable_LabelPart"; + + + public const string DatabaseNotAccessible = "DatabaseNotAccessible"; + + + public const string FilterName = "FilterName"; + + + public const string FilterNameDescription = "FilterNameDescription"; + + + public const string FilterSchema = "FilterSchema"; + + + public const string FilterSchemaDescription = "FilterSchemaDescription"; + + + public const string FilterOwner = "FilterOwner"; + + + public const string FilterOwnerDescription = "FilterOwnerDescription"; + + + public const string FilterDurabilityType = "FilterDurabilityType"; + + + public const string FilterDurabilityTypeDescription = "FilterDurabilityTypeDescription"; + + + public const string FilterDurabilitySchemaOnly = "FilterDurabilitySchemaOnly"; + + + public const string FilterDurabilitySchemaAndData = "FilterDurabilitySchemaAndData"; + + + public const string FilterIsMemoryOptimized = "FilterIsMemoryOptimized"; + + + public const string FilterIsMemoryOptimizedDescription = "FilterIsMemoryOptimizedDescription"; + + + public const string FilterCreateDate = "FilterCreateDate"; + + + public const string FilterCreateDateDescription = "FilterCreateDateDescription"; + + + public const string FilterIsNativelyCompiled = "FilterIsNativelyCompiled"; + + + public const string FilterIsNativelyCompiledDescription = "FilterIsNativelyCompiledDescription"; + + + public const string FilterInPrimaryKey = "FilterInPrimaryKey"; + + + public const string FilterInPrimaryKeyDescription = "FilterInPrimaryKeyDescription"; + + + private Keys() + { } + + public static CultureInfo Culture + { + get + { + return _culture; + } + set + { + _culture = value; + } + } + + public static string GetString(string key) + { + return resourceManager.GetString(key, _culture); + } + + } + } +} diff --git a/src/Microsoft.SqlTools.SqlCore/Localization/sr.resx b/src/Microsoft.SqlTools.SqlCore/Localization/sr.resx new file mode 100644 index 00000000..583aa54e --- /dev/null +++ b/src/Microsoft.SqlTools.SqlCore/Localization/sr.resx @@ -0,0 +1,968 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Error expanding: {0} + + + + Error connecting to {0} + + + + Aggregates + + + + Server Roles + + + + Application Roles + + + + Assemblies + + + + Assembly Files + + + + Asymmetric Keys + + + + Asymmetric Keys + + + + Data Compression Options + + + + Certificates + + + + FileTables + + + + Certificates + + + + Check Constraints + + + + Columns + + + + Constraints + + + + Contracts + + + + Credentials + + + + Error Messages + + + + Server Role Membership + + + + Database Options + + + + Database Roles + + + + Role Memberships + + + + Database Triggers + + + + Default Constraints + + + + Defaults + + + + Sequences + + + + Endpoints + + + + Event Notifications + + + + Server Event Notifications + + + + Extended Properties + + + + Filegroups + + + + Foreign Keys + + + + Full-Text Catalogs + + + + Full-Text Indexes + + + + Functions + + + + Indexes + + + + Inline Functions + + + + Keys + + + + Linked Servers + + + + Logins + + + + Master Key + + + + Master Keys + + + + Message Types + + + + Table-Valued Functions + + + + Parameters + + + + Partition Functions + + + + Partition Schemes + + + + Permissions + + + + Primary Keys + + + + Programmability + + + + Queues + + + + Remote Service Bindings + + + + Returned Columns + + + + Roles + + + + Routes + + + + Rules + + + + Schemas + + + + Built-in Schemas + + + + Security + + + + Server Objects + + + + Management + + + + Triggers + + + + Service Broker + + + + Services + + + + Signatures + + + + Log Files + + + + Statistics + + + + Storage + + + + Stored Procedures + + + + Symmetric Keys + + + + Synonyms + + + + Tables + + + + Triggers + + + + Types + + + + Unique Keys + + + + User-Defined Data Types + + + + User-Defined Types (CLR) + + + + Users + + + + Views + + + + XML Indexes + + + + XML Schema Collections + + + + User-Defined Table Types + + + + Files + + + + Missing Caption + + + + Broker Priorities + + + + Cryptographic Providers + + + + Database Audit Specifications + + + + Database Encryption Keys + + + + Event Sessions + + + + Full Text Stoplists + + + + Resource Pools + + + + Audits + + + + Server Audit Specifications + + + + Spatial Indexes + + + + Workload Groups + + + + SQL Files + + + + Server Functions + + + + SQL Type + + + + Server Options + + + + Database Diagrams + + + + System Tables + + + + Databases + + + + System Contracts + + + + System Databases + + + + System Message Types + + + + System Queues + + + + System Services + + + + System Stored Procedures + + + + System Views + + + + Data-tier Applications + + + + Extended Stored Procedures + + + + Aggregate Functions + + + + Approximate Numerics + + + + Binary Strings + + + + Character Strings + + + + CLR Data Types + + + + Configuration Functions + + + + Cursor Functions + + + + System Data Types + + + + Date and Time + + + + Date and Time Functions + + + + Exact Numerics + + + + System Functions + + + + Hierarchy Id Functions + + + + Mathematical Functions + + + + Metadata Functions + + + + Other Data Types + + + + Other Functions + + + + Rowset Functions + + + + Security Functions + + + + Spatial Data Types + + + + String Functions + + + + System Statistical Functions + + + + Text and Image Functions + + + + Unicode Character Strings + + + + Aggregate Functions + + + + Scalar-valued Functions + + + + Table-valued Functions + + + + System Extended Stored Procedures + + + + Built-in Types + + + + Built-in Server Roles + + + + User with Password + + + + Search Property List + + + + Security Policies + + + + Security Predicates + + + + Server Role + + + + Search Property Lists + + + + Column Store Indexes + + + + Table Type Indexes + + + + Server + + + + Selective XML Indexes + + + + XML Namespaces + + + + XML Typed Promoted Paths + + + + T-SQL Typed Promoted Paths + + + + Database Scoped Credentials + + + + External Data Sources + + + + External File Formats + + + + External Resources + + + + External Tables + + + + Dropped Ledger Columns + + + + Dropped Ledger Tables + + + + Dropped Ledger Views + + + + Always Encrypted Keys + + + + Column Master Keys + + + + Column Encryption Keys + + + + {0} ({1}, {2}, {3}) + + + + No default + + + + Input + + + + Input/Output + + + + Input/ReadOnly + + + + Input/Output/ReadOnly + + + + Default + + + + null + + + + not null + + + + {0} ({1}, {2}) + + + + {0} ({1}) + + + + {0} ({1}Computed, {2}, {3}) + + + + {0} ({1}Computed) + + + + {0} (Column Set, {1}) + + + + {0} (Column Set, {1}{2}, {3}) + + + + {0} (Column Set, {1}, {2}, {3}) + + + + Unique + + + + Non-Unique + + + + Clustered + + + + Non-Clustered + + + + History + + + + System-Versioned + + + + Updatable Ledger + + + + Append-Only Ledger + + + + Ledger + + + + External + + + + File Table + + + + The database {0} is not accessible. + + + + Name + + + + Include or exclude objects based on the name or part of a name. + + + + Schema + + + + Include or exclude objects based on the schema or part of a schema name. + + + + Owner + + + + Include or exclude objects based on the owner or part of an owner name. + + + + Durability Type + + + + Include or exclude objects based on the durability type. + + + + Schema Only + + + + Schema and Data + + + + Is Memory Optimized + + + + Include or exclude objects based on whether the object is memory optimized. + + + + Create Date + + + + Include or exclude objects based on their creation date. + + + + Is Natively Compiled + + + + Include or exclude objects based on whether the object is natively compiled. + + + + In Primary Key + + + + Include or exclude objects based on whether the column is in a primary key. + + + diff --git a/src/Microsoft.SqlTools.SqlCore/Localization/sr.strings b/src/Microsoft.SqlTools.SqlCore/Localization/sr.strings new file mode 100644 index 00000000..3d6f67e9 --- /dev/null +++ b/src/Microsoft.SqlTools.SqlCore/Localization/sr.strings @@ -0,0 +1,432 @@ +# String resource file +# +# When processed by the String Resource Tool, this file generates +# both a .CS and a .RESX file with the same name as the file. +# The .CS file contains a class which can be used to access these +# string resources, including the ability to format in +# parameters, which are identified with the .NET {x} format +# (see String.Format help). +# +# Comments below assume the file name is SR.strings. +# +# Lines starting with a semicolon ";" are also treated as comments, but +# in a future version they will be extracted and made available in LocStudio +# Put your comments to localizers _before_ the string they apply to. +# +# SMO build specific comment +# after generating the .resx file, run srgen on it and get the .resx file +# please remember to also check that .resx in, along with the +# .strings and .cs files + +[strings] + +############################################################################ +# Object Explorer Service + +TreeNodeError = Error expanding: {0} + +ServerNodeConnectionError = Error connecting to {0} + +SchemaHierarchy_Aggregates = Aggregates + +SchemaHierarchy_ServerRoles = Server Roles + +SchemaHierarchy_ApplicationRoles = Application Roles + +SchemaHierarchy_Assemblies = Assemblies + +SchemaHierarchy_AssemblyFiles = Assembly Files + +SchemaHierarchy_AsymmetricKeys = Asymmetric Keys + +SchemaHierarchy_DatabaseAsymmetricKeys = Asymmetric Keys + +SchemaHierarchy_DataCompressionOptions = Data Compression Options + +SchemaHierarchy_Certificates = Certificates + +SchemaHierarchy_FileTables = FileTables + +SchemaHierarchy_DatabaseCertificates = Certificates + +SchemaHierarchy_CheckConstraints = Check Constraints + +SchemaHierarchy_Columns = Columns + +SchemaHierarchy_Constraints = Constraints + +SchemaHierarchy_Contracts = Contracts + +SchemaHierarchy_Credentials = Credentials + +SchemaHierarchy_ErrorMessages = Error Messages + +SchemaHierarchy_ServerRoleMembership = Server Role Membership + +SchemaHierarchy_DatabaseOptions = Database Options + +SchemaHierarchy_DatabaseRoles = Database Roles + +SchemaHierarchy_RoleMemberships = Role Memberships + +SchemaHierarchy_DatabaseTriggers = Database Triggers + +SchemaHierarchy_DefaultConstraints = Default Constraints + +SchemaHierarchy_Defaults = Defaults + +SchemaHierarchy_Sequences = Sequences + +SchemaHierarchy_Endpoints = Endpoints + +SchemaHierarchy_EventNotifications = Event Notifications + +SchemaHierarchy_ServerEventNotifications = Server Event Notifications + +SchemaHierarchy_ExtendedProperties = Extended Properties + +SchemaHierarchy_FileGroups = Filegroups + +SchemaHierarchy_ForeignKeys = Foreign Keys + +SchemaHierarchy_FullTextCatalogs = Full-Text Catalogs + +SchemaHierarchy_FullTextIndexes = Full-Text Indexes + +SchemaHierarchy_Functions = Functions + +SchemaHierarchy_Indexes = Indexes + +SchemaHierarchy_InlineFunctions = Inline Functions + +SchemaHierarchy_Keys = Keys + +SchemaHierarchy_LinkedServers = Linked Servers + +SchemaHierarchy_Logins = Logins + +SchemaHierarchy_MasterKey = Master Key + +SchemaHierarchy_MasterKeys = Master Keys + +SchemaHierarchy_MessageTypes = Message Types + +SchemaHierarchy_MultiSelectFunctions = Table-Valued Functions + +SchemaHierarchy_Parameters = Parameters + +SchemaHierarchy_PartitionFunctions = Partition Functions + +SchemaHierarchy_PartitionSchemes = Partition Schemes + +SchemaHierarchy_Permissions = Permissions + +SchemaHierarchy_PrimaryKeys = Primary Keys + +SchemaHierarchy_Programmability = Programmability + +SchemaHierarchy_Queues = Queues + +SchemaHierarchy_RemoteServiceBindings = Remote Service Bindings + +SchemaHierarchy_ReturnedColumns = Returned Columns + +SchemaHierarchy_Roles = Roles + +SchemaHierarchy_Routes = Routes + +SchemaHierarchy_Rules = Rules + +SchemaHierarchy_Schemas = Schemas + +SchemaHierarchy_BuiltInSchema = Built-in Schemas + +SchemaHierarchy_Security = Security + +SchemaHierarchy_ServerObjects = Server Objects + +SchemaHierarchy_Management = Management + +SchemaHierarchy_ServerTriggers = Triggers + +SchemaHierarchy_ServiceBroker = Service Broker + +SchemaHierarchy_Services = Services + +SchemaHierarchy_Signatures = Signatures + +SchemaHierarchy_LogFiles = Log Files + +SchemaHierarchy_Statistics = Statistics + +SchemaHierarchy_Storage = Storage + +SchemaHierarchy_StoredProcedures = Stored Procedures + +SchemaHierarchy_SymmetricKeys = Symmetric Keys + +SchemaHierarchy_Synonyms = Synonyms + +SchemaHierarchy_Tables = Tables + +SchemaHierarchy_Triggers = Triggers + +SchemaHierarchy_Types = Types + +SchemaHierarchy_UniqueKeys = Unique Keys + +SchemaHierarchy_UserDefinedDataTypes = User-Defined Data Types + +SchemaHierarchy_UserDefinedTypes = User-Defined Types (CLR) + +SchemaHierarchy_Users = Users + +SchemaHierarchy_Views = Views + +SchemaHierarchy_XmlIndexes = XML Indexes + +SchemaHierarchy_XMLSchemaCollections = XML Schema Collections + +SchemaHierarchy_UserDefinedTableTypes = User-Defined Table Types + +SchemaHierarchy_FilegroupFiles = Files + +MissingCaption = Missing Caption + +SchemaHierarchy_BrokerPriorities = Broker Priorities + +SchemaHierarchy_CryptographicProviders = Cryptographic Providers + +SchemaHierarchy_DatabaseAuditSpecifications = Database Audit Specifications + +SchemaHierarchy_DatabaseEncryptionKeys = Database Encryption Keys + +SchemaHierarchy_EventSessions = Event Sessions + +SchemaHierarchy_FullTextStopLists = Full Text Stoplists + +SchemaHierarchy_ResourcePools = Resource Pools + +SchemaHierarchy_ServerAudits = Audits + +SchemaHierarchy_ServerAuditSpecifications = Server Audit Specifications + +SchemaHierarchy_SpatialIndexes = Spatial Indexes + +SchemaHierarchy_WorkloadGroups = Workload Groups + +SchemaHierarchy_SqlFiles = SQL Files + +SchemaHierarchy_ServerFunctions = Server Functions + +SchemaHierarchy_SqlType = SQL Type + +SchemaHierarchy_ServerOptions = Server Options + +SchemaHierarchy_DatabaseDiagrams = Database Diagrams + +SchemaHierarchy_SystemTables = System Tables + +SchemaHierarchy_Databases = Databases + +SchemaHierarchy_SystemContracts = System Contracts + +SchemaHierarchy_SystemDatabases = System Databases + +SchemaHierarchy_SystemMessageTypes = System Message Types + +SchemaHierarchy_SystemQueues = System Queues + +SchemaHierarchy_SystemServices = System Services + +SchemaHierarchy_SystemStoredProcedures = System Stored Procedures + +SchemaHierarchy_SystemViews = System Views + +SchemaHierarchy_DataTierApplications = Data-tier Applications + +SchemaHierarchy_ExtendedStoredProcedures = Extended Stored Procedures + +SchemaHierarchy_SystemAggregateFunctions = Aggregate Functions + +SchemaHierarchy_SystemApproximateNumerics = Approximate Numerics + +SchemaHierarchy_SystemBinaryStrings = Binary Strings + +SchemaHierarchy_SystemCharacterStrings = Character Strings + +SchemaHierarchy_SystemCLRDataTypes = CLR Data Types + +SchemaHierarchy_SystemConfigurationFunctions = Configuration Functions + +SchemaHierarchy_SystemCursorFunctions = Cursor Functions + +SchemaHierarchy_SystemDataTypes = System Data Types + +SchemaHierarchy_SystemDateAndTime = Date and Time + +SchemaHierarchy_SystemDateAndTimeFunctions = Date and Time Functions + +SchemaHierarchy_SystemExactNumerics = Exact Numerics + +SchemaHierarchy_SystemFunctions = System Functions + +SchemaHierarchy_SystemHierarchyIdFunctions = Hierarchy Id Functions + +SchemaHierarchy_SystemMathematicalFunctions = Mathematical Functions + +SchemaHierarchy_SystemMetadataFunctions = Metadata Functions + +SchemaHierarchy_SystemOtherDataTypes = Other Data Types + +SchemaHierarchy_SystemOtherFunctions = Other Functions + +SchemaHierarchy_SystemRowsetFunctions = Rowset Functions + +SchemaHierarchy_SystemSecurityFunctions = Security Functions + +SchemaHierarchy_SystemSpatialDataTypes = Spatial Data Types + +SchemaHierarchy_SystemStringFunctions = String Functions + +SchemaHierarchy_SystemSystemStatisticalFunctions = System Statistical Functions + +SchemaHierarchy_SystemTextAndImageFunctions = Text and Image Functions + +SchemaHierarchy_SystemUnicodeCharacterStrings = Unicode Character Strings + +SchemaHierarchy_AggregateFunctions = Aggregate Functions + +SchemaHierarchy_ScalarValuedFunctions = Scalar-valued Functions + +SchemaHierarchy_TableValuedFunctions = Table-valued Functions + +SchemaHierarchy_SystemExtendedStoredProcedures = System Extended Stored Procedures + +SchemaHierarchy_BuiltInType = Built-in Types + +SchemaHierarchy_BuiltInServerRole = Built-in Server Roles + +SchemaHierarchy_UserWithPassword = User with Password + +SchemaHierarchy_SearchPropertyList = Search Property List + +SchemaHierarchy_SecurityPolicies = Security Policies + +SchemaHierarchy_SecurityPredicates = Security Predicates + +SchemaHierarchy_ServerRole = Server Role + +SchemaHierarchy_SearchPropertyLists = Search Property Lists + +SchemaHierarchy_ColumnStoreIndexes = Column Store Indexes + +SchemaHierarchy_TableTypeIndexes = Table Type Indexes + +SchemaHierarchy_Server = Server + +SchemaHierarchy_SelectiveXmlIndexes = Selective XML Indexes + +SchemaHierarchy_XmlNamespaces = XML Namespaces + +SchemaHierarchy_XmlTypedPromotedPaths = XML Typed Promoted Paths + +SchemaHierarchy_SqlTypedPromotedPaths = T-SQL Typed Promoted Paths + +SchemaHierarchy_DatabaseScopedCredentials = Database Scoped Credentials + +SchemaHierarchy_ExternalDataSources = External Data Sources + +SchemaHierarchy_ExternalFileFormats = External File Formats + +SchemaHierarchy_ExternalResources = External Resources + +SchemaHierarchy_ExternalTables = External Tables + +SchemaHierarchy_DroppedLedgerColumns = Dropped Ledger Columns + +SchemaHierarchy_DroppedLedgerTables = Dropped Ledger Tables + +SchemaHierarchy_DroppedLedgerViews = Dropped Ledger Views + +SchemaHierarchy_AlwaysEncryptedKeys = Always Encrypted Keys + +SchemaHierarchy_ColumnMasterKeys = Column Master Keys + +SchemaHierarchy_ColumnEncryptionKeys = Column Encryption Keys + +SchemaHierarchy_SubroutineParameterLabelFormatString = {0} ({1}, {2}, {3}) + +SchemaHierarchy_SubroutineParameterNoDefaultLabel = No default + +SchemaHierarchy_SubroutineParameterInputLabel = Input + +SchemaHierarchy_SubroutineParameterInputOutputLabel = Input/Output + +SchemaHierarchy_SubroutineParameterInputReadOnlyLabel = Input/ReadOnly + +SchemaHierarchy_SubroutineParameterInputOutputReadOnlyLabel = Input/Output/ReadOnly + +SchemaHierarchy_SubroutineParameterDefaultLabel = Default + +SchemaHierarchy_NullColumn_Label = null + +SchemaHierarchy_NotNullColumn_Label = not null + +SchemaHierarchy_UDDTLabelWithType = {0} ({1}, {2}) + +SchemaHierarchy_UDDTLabelWithoutType = {0} ({1}) + +SchemaHierarchy_ComputedColumnLabelWithType = {0} ({1}Computed, {2}, {3}) + +SchemaHierarchy_ComputedColumnLabelWithoutType = {0} ({1}Computed) + +SchemaHierarchy_ColumnSetLabelWithoutType = {0} (Column Set, {1}) + +SchemaHierarchy_ColumnSetLabelWithType = {0} (Column Set, {1}{2}, {3}) + +SchemaHierarchy_ColumnSetLabelWithTypeAndKeyString = {0} (Column Set, {1}, {2}, {3}) + +UniqueIndex_LabelPart = Unique + +NonUniqueIndex_LabelPart = Non-Unique + +ClusteredIndex_LabelPart = Clustered + +NonClusteredIndex_LabelPart = Non-Clustered + +History_LabelPart = History + +SystemVersioned_LabelPart = System-Versioned + +UpdatableLedger_LabelPart = Updatable Ledger + +AppendOnlyLedger_LabelPart = Append-Only Ledger + +Ledger_LabelPart = Ledger + +External_LabelPart = External + +FileTable_LabelPart = File Table + +DatabaseNotAccessible = The database {0} is not accessible. + +FilterName = Name +FilterNameDescription = Include or exclude objects based on the name or part of a name. +FilterSchema = Schema +FilterSchemaDescription = Include or exclude objects based on the schema or part of a schema name. +FilterOwner = Owner +FilterOwnerDescription = Include or exclude objects based on the owner or part of an owner name. +FilterDurabilityType = Durability Type +FilterDurabilityTypeDescription = Include or exclude objects based on the durability type. +FilterDurabilitySchemaOnly = Schema Only +FilterDurabilitySchemaAndData = Schema and Data +FilterIsMemoryOptimized = Is Memory Optimized +FilterIsMemoryOptimizedDescription = Include or exclude objects based on whether the object is memory optimized. +FilterCreateDate = Create Date +FilterCreateDateDescription = Include or exclude objects based on their creation date. +FilterIsNativelyCompiled = Is Natively Compiled +FilterIsNativelyCompiledDescription = Include or exclude objects based on whether the object is natively compiled. +FilterInPrimaryKey = In Primary Key +FilterInPrimaryKeyDescription = Include or exclude objects based on whether the column is in a primary key. + diff --git a/src/Microsoft.SqlTools.SqlCore/Localization/sr.xlf b/src/Microsoft.SqlTools.SqlCore/Localization/sr.xlf new file mode 100644 index 00000000..8a1cb1df --- /dev/null +++ b/src/Microsoft.SqlTools.SqlCore/Localization/sr.xlf @@ -0,0 +1,1067 @@ + + + + + + Error expanding: {0} + Error expanding: {0} + + + + Error connecting to {0} + Error connecting to {0} + + + + Aggregates + Aggregates + + + + Server Roles + Server Roles + + + + Application Roles + Application Roles + + + + Assemblies + Assemblies + + + + Assembly Files + Assembly Files + + + + Asymmetric Keys + Asymmetric Keys + + + + Asymmetric Keys + Asymmetric Keys + + + + Data Compression Options + Data Compression Options + + + + Certificates + Certificates + + + + FileTables + FileTables + + + + Certificates + Certificates + + + + Check Constraints + Check Constraints + + + + Columns + Columns + + + + Constraints + Constraints + + + + Contracts + Contracts + + + + Credentials + Credentials + + + + Error Messages + Error Messages + + + + Server Role Membership + Server Role Membership + + + + Database Options + Database Options + + + + Database Roles + Database Roles + + + + Role Memberships + Role Memberships + + + + Database Triggers + Database Triggers + + + + Default Constraints + Default Constraints + + + + Defaults + Defaults + + + + Sequences + Sequences + + + + Endpoints + Endpoints + + + + Event Notifications + Event Notifications + + + + Server Event Notifications + Server Event Notifications + + + + Extended Properties + Extended Properties + + + + Filegroups + Filegroups + + + + Foreign Keys + Foreign Keys + + + + Full-Text Catalogs + Full-Text Catalogs + + + + Full-Text Indexes + Full-Text Indexes + + + + Functions + Functions + + + + Indexes + Indexes + + + + Inline Functions + Inline Functions + + + + Keys + Keys + + + + Linked Servers + Linked Servers + + + + Logins + Logins + + + + Master Key + Master Key + + + + Master Keys + Master Keys + + + + Message Types + Message Types + + + + Table-Valued Functions + Table-Valued Functions + + + + Parameters + Parameters + + + + Partition Functions + Partition Functions + + + + Partition Schemes + Partition Schemes + + + + Permissions + Permissions + + + + Primary Keys + Primary Keys + + + + Programmability + Programmability + + + + Queues + Queues + + + + Remote Service Bindings + Remote Service Bindings + + + + Returned Columns + Returned Columns + + + + Roles + Roles + + + + Routes + Routes + + + + Rules + Rules + + + + Schemas + Schemas + + + + Security + Security + + + + Server Objects + Server Objects + + + + Management + Management + + + + Triggers + Triggers + + + + Service Broker + Service Broker + + + + Services + Services + + + + Signatures + Signatures + + + + Log Files + Log Files + + + + Statistics + Statistics + + + + Storage + Storage + + + + Stored Procedures + Stored Procedures + + + + Symmetric Keys + Symmetric Keys + + + + Synonyms + Synonyms + + + + Tables + Tables + + + + Triggers + Triggers + + + + Types + Types + + + + Unique Keys + Unique Keys + + + + User-Defined Data Types + User-Defined Data Types + + + + User-Defined Types (CLR) + User-Defined Types (CLR) + + + + Users + Users + + + + Views + Views + + + + XML Indexes + XML Indexes + + + + XML Schema Collections + XML Schema Collections + + + + User-Defined Table Types + User-Defined Table Types + + + + Files + Files + + + + Missing Caption + Missing Caption + + + + Broker Priorities + Broker Priorities + + + + Cryptographic Providers + Cryptographic Providers + + + + Database Audit Specifications + Database Audit Specifications + + + + Database Encryption Keys + Database Encryption Keys + + + + Event Sessions + Event Sessions + + + + Full Text Stoplists + Full Text Stoplists + + + + Resource Pools + Resource Pools + + + + Audits + Audits + + + + Server Audit Specifications + Server Audit Specifications + + + + Spatial Indexes + Spatial Indexes + + + + Workload Groups + Workload Groups + + + + SQL Files + SQL Files + + + + Server Functions + Server Functions + + + + SQL Type + SQL Type + + + + Server Options + Server Options + + + + Database Diagrams + Database Diagrams + + + + System Tables + System Tables + + + + Databases + Databases + + + + System Contracts + System Contracts + + + + System Databases + System Databases + + + + System Message Types + System Message Types + + + + System Queues + System Queues + + + + System Services + System Services + + + + System Stored Procedures + System Stored Procedures + + + + System Views + System Views + + + + Data-tier Applications + Data-tier Applications + + + + Extended Stored Procedures + Extended Stored Procedures + + + + Aggregate Functions + Aggregate Functions + + + + Approximate Numerics + Approximate Numerics + + + + Binary Strings + Binary Strings + + + + Character Strings + Character Strings + + + + CLR Data Types + CLR Data Types + + + + Configuration Functions + Configuration Functions + + + + Cursor Functions + Cursor Functions + + + + System Data Types + System Data Types + + + + Date and Time + Date and Time + + + + Date and Time Functions + Date and Time Functions + + + + Exact Numerics + Exact Numerics + + + + System Functions + System Functions + + + + Hierarchy Id Functions + Hierarchy Id Functions + + + + Mathematical Functions + Mathematical Functions + + + + Metadata Functions + Metadata Functions + + + + Other Data Types + Other Data Types + + + + Other Functions + Other Functions + + + + Rowset Functions + Rowset Functions + + + + Security Functions + Security Functions + + + + Spatial Data Types + Spatial Data Types + + + + String Functions + String Functions + + + + System Statistical Functions + System Statistical Functions + + + + Text and Image Functions + Text and Image Functions + + + + Unicode Character Strings + Unicode Character Strings + + + + Aggregate Functions + Aggregate Functions + + + + Scalar-valued Functions + Scalar-valued Functions + + + + Table-valued Functions + Table-valued Functions + + + + System Extended Stored Procedures + System Extended Stored Procedures + + + + Built-in Types + Built-in Types + + + + Built-in Server Roles + Built-in Server Roles + + + + User with Password + User with Password + + + + Search Property List + Search Property List + + + + Security Policies + Security Policies + + + + Security Predicates + Security Predicates + + + + Server Role + Server Role + + + + Search Property Lists + Search Property Lists + + + + Column Store Indexes + Column Store Indexes + + + + Table Type Indexes + Table Type Indexes + + + + Selective XML Indexes + Selective XML Indexes + + + + XML Namespaces + XML Namespaces + + + + XML Typed Promoted Paths + XML Typed Promoted Paths + + + + T-SQL Typed Promoted Paths + T-SQL Typed Promoted Paths + + + + Database Scoped Credentials + Database Scoped Credentials + + + + External Data Sources + External Data Sources + + + + External File Formats + External File Formats + + + + External Resources + External Resources + + + + External Tables + External Tables + + + + Always Encrypted Keys + Always Encrypted Keys + + + + Column Master Keys + Column Master Keys + + + + Column Encryption Keys + Column Encryption Keys + + + + Server + Server + + + + {0} ({1}, {2}, {3}) + {0} ({1}, {2}, {3}) + + + + No default + No default + + + + Input + Input + + + + Input/Output + Input/Output + + + + Input/ReadOnly + Input/ReadOnly + + + + Input/Output/ReadOnly + Input/Output/ReadOnly + + + + Default + Default + + + + null + null + + + + not null + not null + + + + {0} ({1}, {2}) + {0} ({1}, {2}) + + + + {0} ({1}) + {0} ({1}) + + + + {0} ({1}Computed, {2}, {3}) + {0} ({1}Computed, {2}, {3}) + + + + {0} ({1}Computed) + {0} ({1}Computed) + + + + {0} (Column Set, {1}) + {0} (Column Set, {1}) + + + + {0} (Column Set, {1}{2}, {3}) + {0} (Column Set, {1}{2}, {3}) + + + + {0} (Column Set, {1}, {2}, {3}) + {0} (Column Set, {1}, {2}, {3}) + + + + Unique + Unique + + + + Non-Unique + Non-Unique + + + + Clustered + Clustered + + + + Non-Clustered + Non-Clustered + + + + History + History + + + + System-Versioned + System-Versioned + + + + The database {0} is not accessible. + The database {0} is not accessible. + + + + External + External + + + + File Table + File Table + + + + Updatable Ledger + Updatable Ledger + + + + Append-Only Ledger + Append-Only Ledger + + + + Ledger + Ledger + + + + Dropped Ledger Tables + Dropped Ledger Tables + + + + Dropped Ledger Views + Dropped Ledger Views + + + + Dropped Ledger Columns + Dropped Ledger Columns + + + + Built-in Schemas + Built-in Schemas + + + + Name + Name + + + + Include or exclude objects based on the name or part of a name. + Include or exclude objects based on the name or part of a name. + + + + Schema + Schema + + + + Include or exclude objects based on the schema or part of a schema name. + Include or exclude objects based on the schema or part of a schema name. + + + + Owner + Owner + + + + Include or exclude objects based on the owner or part of an owner name. + Include or exclude objects based on the owner or part of an owner name. + + + + Durability Type + Durability Type + + + + Include or exclude objects based on the durability type. + Include or exclude objects based on the durability type. + + + + Is Memory Optimized + Is Memory Optimized + + + + Include or exclude objects based on whether the object is memory optimized. + Include or exclude objects based on whether the object is memory optimized. + + + + Create Date + Create Date + + + + Include or exclude objects based on their creation date. + Include or exclude objects based on their creation date. + + + + Is Natively Compiled + Is Natively Compiled + + + + Include or exclude objects based on whether the object is natively compiled. + Include or exclude objects based on whether the object is natively compiled. + + + + In Primary Key + In Primary Key + + + + Include or exclude objects based on whether the column is in a primary key. + Include or exclude objects based on whether the column is in a primary key. + + + + Schema Only + Schema Only + + + + Schema and Data + Schema and Data + + + + + \ No newline at end of file diff --git a/src/Microsoft.SqlTools.ServiceLayer/Metadata/Contracts/ObjectMetadata.cs b/src/Microsoft.SqlTools.SqlCore/Metadata/ObjectMetadata.cs similarity index 91% rename from src/Microsoft.SqlTools.ServiceLayer/Metadata/Contracts/ObjectMetadata.cs rename to src/Microsoft.SqlTools.SqlCore/Metadata/ObjectMetadata.cs index c2afda2b..12d01b82 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Metadata/Contracts/ObjectMetadata.cs +++ b/src/Microsoft.SqlTools.SqlCore/Metadata/ObjectMetadata.cs @@ -3,9 +3,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - -namespace Microsoft.SqlTools.ServiceLayer.Metadata.Contracts +namespace Microsoft.SqlTools.SqlCore.Metadata { /// /// Metadata type enumeration diff --git a/src/Microsoft.SqlTools.SqlCore/Microsoft.SqlTools.SqlCore.csproj b/src/Microsoft.SqlTools.SqlCore/Microsoft.SqlTools.SqlCore.csproj new file mode 100644 index 00000000..101b6242 --- /dev/null +++ b/src/Microsoft.SqlTools.SqlCore/Microsoft.SqlTools.SqlCore.csproj @@ -0,0 +1,39 @@ + + + MicrosoftSqlToolsSqlCore + disable + false + false + false + false + false + $(DefineConstants);NETCOREAPP1_0;TRACE + true + true + SqlTools SqlCore Library + Provides core sql functionality for SQL server editors like Object explorer, Query Execution and Scripting + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/IObjectExplorerSession.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/IObjectExplorerSession.cs new file mode 100644 index 00000000..07979ccb --- /dev/null +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/IObjectExplorerSession.cs @@ -0,0 +1,14 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; + +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer +{ + public class IObjectExplorerSession + { + public TreeNode Root { get; protected set; } + } +} \ No newline at end of file diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/ChildFactory.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/ChildFactory.cs similarity index 92% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/ChildFactory.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/ChildFactory.cs index 2286d8ae..458ed3e0 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/ChildFactory.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/ChildFactory.cs @@ -3,14 +3,11 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System.Collections.Generic; using System.Threading; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes { /// /// A supports creation of children @@ -36,7 +33,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes /// include system objects /// cancellation token /// filters to apply - public abstract IEnumerable Expand(TreeNode parent, bool refresh, string name, bool includeSystemObjects, CancellationToken cancellationToken, IEnumerable? filters); + public abstract IEnumerable Expand(TreeNode parent, bool refresh, string name, bool includeSystemObjects, CancellationToken cancellationToken, IEnumerable? filters); /// /// The list of filters that should be applied on the smo object list diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/INodeFilter.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/INodeFilter.cs similarity index 97% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/INodeFilter.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/INodeFilter.cs index 54668c41..8530eae6 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/INodeFilter.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/INodeFilter.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes { /// /// Has information for filtering a SMO object by properties diff --git a/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeFilterProperty.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeFilterProperty.cs new file mode 100644 index 00000000..a14ccfe5 --- /dev/null +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeFilterProperty.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes +{ + + /// + /// The filterable properties that a node supports + /// + public class NodeFilterProperty + { + /// + /// The name of the filter property + /// + public string? Name { get; set; } + /// + /// The name of the filter property displayed to the user + /// + public string? DisplayName { get; set; } + /// + /// The description of the filter property + /// + public string? Description { get; set; } + /// + /// The data type of the filter property + /// + public NodeFilterPropertyDataType Type { get; set; } + /// + /// The list of choices for the filter property if the type is choice + /// + public NodeFilterPropertyChoice[]? Choices { get; set; } + } + + + /// + /// The data type of the filter property. Matches NodeFilterPropertyDataType enum in ADS : https://github.com/microsoft/azuredatastudio/blob/main/src/sql/azdata.proposed.d.ts#L1847-L1853 + /// + public enum NodeFilterPropertyDataType + { + String = 0, + Number = 1, + Boolean = 2, + Date = 3, + Choice = 4 + } + + /// + /// The choice for the filter property if the type is choice + /// + public class NodeFilterPropertyChoice + { + /// + /// The dropdown display value for the choice + /// + /// + public string? DisplayName { get; set; } + + /// + /// The value of the choice + /// + public string? Value { get; set; } + } + +} \ No newline at end of file diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeObservableCollection.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeObservableCollection.cs similarity index 97% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeObservableCollection.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeObservableCollection.cs index 770cdaf7..0f864b35 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeObservableCollection.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeObservableCollection.cs @@ -2,16 +2,14 @@ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // - -#nullable disable - -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes +using Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel; + +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes { /// /// A collection class for diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeOrFilter.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeOrFilter.cs similarity index 96% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeOrFilter.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeOrFilter.cs index 8e63be6d..5d2df215 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeOrFilter.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeOrFilter.cs @@ -3,13 +3,11 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System; using System.Collections.Generic; using System.Text; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes { /// /// Has information for filtering a SMO object by properties diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodePropertyFilter.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodePropertyFilter.cs similarity index 98% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodePropertyFilter.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodePropertyFilter.cs index 4e67c883..222036f2 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodePropertyFilter.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodePropertyFilter.cs @@ -2,17 +2,14 @@ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // - -#nullable disable - using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; -using Microsoft.SqlTools.ServiceLayer.Management; +using Microsoft.SqlTools.SqlCore.Utility; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes { /// /// Has information for filtering a SMO object by properties @@ -186,7 +183,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes if (Type == typeof(string)) { //Replacing quotes with double quotes - var escapedString = CUtils.EscapeStringSQuote(propertyValue.ToString()); + var escapedString = StringUtils.EscapeStringSQuote(propertyValue.ToString()); if (this.FilterType == FilterType.STARTSWITH || this.FilterType == FilterType.ENDSWITH) { escapedString = EscapeLikeURNRegex().Replace(escapedString, "[$0]"); diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeSmoProperty.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeSmoProperty.cs similarity index 87% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeSmoProperty.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeSmoProperty.cs index 2ae05df4..97d4b95a 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeSmoProperty.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeSmoProperty.cs @@ -3,10 +3,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - - -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes { /// /// Has information for SMO object properties to be loaded with the SMO object diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeTypes.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeTypes.cs similarity index 98% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeTypes.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeTypes.cs index ab32f732..8e2aa431 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeTypes.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeTypes.cs @@ -7,7 +7,7 @@ // and re-run the T4 template. This can be done in Visual Studio by right-click in and choosing "Run Custom Tool", // or from the command-line on any platform by running "build.cmd -Target=CodeGen" or "build.sh -Target=CodeGen" -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes { /// /// Enum listing possible node types in the object explorer tree diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeTypes.tt b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeTypes.tt similarity index 98% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeTypes.tt rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeTypes.tt index 2b2a5efc..d0e422b5 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeTypes.tt +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/NodeTypes.tt @@ -18,7 +18,7 @@ // and re-run the T4 template. This can be done in Visual Studio by right-click in and choosing "Run Custom Tool", // or from the command-line on any platform by running "build.cmd -Target=CodeGen" or "build.sh -Target=CodeGen" -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes { /// /// Enum listing possible node types in the object explorer tree diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNode.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/TreeNode.cs similarity index 86% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNode.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/TreeNode.cs index 062ccce4..2dbe8b90 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNode.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/TreeNode.cs @@ -2,22 +2,18 @@ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // - -#nullable disable - using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.Threading; -using Microsoft.SqlTools.ServiceLayer.Metadata.Contracts; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel; -using Microsoft.SqlTools.ServiceLayer.Utility; +using Microsoft.SqlTools.SqlCore.Metadata; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel; +using Microsoft.SqlTools.SqlCore.Utility; using Microsoft.SqlTools.Utility; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes { /// /// Base class for elements in the object explorer tree. Provides common methods for tree navigation @@ -30,6 +26,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes private string nodePath; private string label; private string nodePathName; + private static Lazy>> ApplicableNodeChildFactories; public const char PathPartSeperator = '/'; /// @@ -206,7 +203,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes nodePath = path; } - public TreeNode? FindNodeByPath(string path, bool expandIfNeeded = false) + public TreeNode? FindNodeByPath(string path, bool expandIfNeeded = false, CancellationToken cancellationToken = new CancellationToken()) { TreeNode? nodeForPath = ObjectExplorerUtils.FindNode(this, node => { @@ -214,39 +211,17 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes }, nodeToFilter => { return path.StartsWith(nodeToFilter.GetNodePath()); - }, expandIfNeeded); + }, expandIfNeeded, cancellationToken); return nodeForPath; } - /// - /// Converts to a object for serialization with just the relevant properties - /// needed to identify the node - /// - /// - public NodeInfo ToNodeInfo() - { - return new NodeInfo() - { - IsLeaf = this.IsAlwaysLeaf, - Label = this.Label, - NodePath = this.GetNodePath(), - ParentNodePath = this.Parent?.GetNodePath() ?? "", - NodeType = this.NodeType, - Metadata = this.ObjectMetadata, - NodeStatus = this.NodeStatus, - NodeSubType = this.NodeSubType, - ErrorMessage = this.ErrorMessage, - ObjectType = this.NodeTypeId.ToString(), - FilterableProperties = this.FilterProperties - }; - } /// /// Expands this node and returns its children /// /// Children as an IList. This is the raw children collection, not a copy - public IList Expand(string name, CancellationToken cancellationToken, string? accessToken = null, IEnumerable? filters = null) + public IList Expand(string name, CancellationToken cancellationToken, string? accessToken = null, IEnumerable? filters = null) { // TODO consider why solution explorer has separate Children and Items options if (children.IsInitialized) @@ -261,7 +236,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes /// Expands this node and returns its children /// /// Children as an IList. This is the raw children collection, not a copy - public IList Expand(CancellationToken cancellationToken, string? accessToken = null, IEnumerable? filters = null) + public IList Expand(CancellationToken cancellationToken, string? accessToken = null, IEnumerable? filters = null) { return Expand(null, cancellationToken, accessToken, filters); } @@ -270,7 +245,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes /// Refresh this node and returns its children /// /// Children as an IList. This is the raw children collection, not a copy - public virtual IList Refresh(CancellationToken cancellationToken, string? accessToken = null, IEnumerable? filters = null) + public virtual IList Refresh(CancellationToken cancellationToken, string? accessToken = null, IEnumerable? filters = null) { // TODO consider why solution explorer has separate Children and Items options PopulateChildren(true, null, cancellationToken, accessToken, filters); @@ -325,7 +300,48 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes return Parent as T; } - protected virtual void PopulateChildren(bool refresh, string name, CancellationToken cancellationToken, string? accessToken = null, IEnumerable? filters = null) + private void PopulateFactories() + { + var factories = new Dictionary>(); + + var serviceProvider = this.GetContextAs().ServiceProvider; + + foreach (var factory in serviceProvider.GetServices()) + { + var parents = factory.ApplicableParents(); + if (parents != null) + { + foreach (var parent in parents) + { + HashSet applicableFactories; + if (!factories.TryGetValue(parent, out applicableFactories)) + { + applicableFactories = new HashSet(); + factories[parent] = applicableFactories; + } + applicableFactories.Add(factory); + } + } + } + ApplicableNodeChildFactories = new Lazy>>(factories); + } + + public IEnumerable GetApplicableChildFactories() + { + if (TreeNode.ApplicableNodeChildFactories == null) + { + this.PopulateFactories(); + } + + HashSet applicableFactories; + if (ApplicableNodeChildFactories.Value.TryGetValue(NodeTypeId.ToString(), out applicableFactories)) + { + return applicableFactories; + } + return null; + } + + protected virtual void PopulateChildren(bool refresh, string name, CancellationToken cancellationToken, string? accessToken = null, IEnumerable? filters = null) { Logger.Verbose(string.Format(CultureInfo.InvariantCulture, "Populating oe node :{0}", this.GetNodePath())); Debug.Assert(IsAlwaysLeaf == false); @@ -347,7 +363,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes try { ErrorMessage = null; - IEnumerable childFactories = context.GetObjectExplorerService().GetApplicableChildFactories(this); + IEnumerable childFactories = this.GetApplicableChildFactories(); if (childFactories != null) { foreach (var factory in childFactories) diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNodeWithContext.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/TreeNodeWithContext.cs similarity index 77% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNodeWithContext.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/TreeNodeWithContext.cs index 888bd130..f50fe86c 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNodeWithContext.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/Nodes/TreeNodeWithContext.cs @@ -3,7 +3,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes { public class TreeNodeWithContext { diff --git a/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/ObjectExplorerOptions.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/ObjectExplorerOptions.cs new file mode 100644 index 00000000..fba6c1e7 --- /dev/null +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/ObjectExplorerOptions.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer +{ + public class ObjectExplorerOptions + { + /// + /// Function that returns flag to group nodes by schema. Default is false + /// + public Func GroupBySchemaFlagGetter { get; set; } = () => false; + + /// + /// Timeout for OE session operations in seconds. Default is 60 seconds + /// + public int OperationTimeoutSeconds { get; set; } = 60; + } +} \ No newline at end of file diff --git a/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/ObjectExplorerServerInfo.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/ObjectExplorerServerInfo.cs new file mode 100644 index 00000000..38b9c44f --- /dev/null +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/ObjectExplorerServerInfo.cs @@ -0,0 +1,42 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer +{ + public class ObjectExplorerServerInfo + { + /// + /// Server name for the OE session + /// + public string? ServerName { get; set; } + /// + /// Database name for the OE session + /// + public string? DatabaseName { get; set; } + /// + /// User name for the OE session + /// + public string? UserName { get; set; } + /// + /// SQL Server version for the OE session + /// + public string? ServerVersion { get; set; } + /// + /// SQL Server edition for the OE session + /// + public int EngineEditionId { get; set; } + /// + /// Checks if the OE session is for Azure SQL DB + /// + public bool IsCloud { get; set; } + /// + /// Indicates if the OE session is for default or system database + /// + public bool isDefaultOrSystemDatabase { get; set; } + } +} + + + \ No newline at end of file diff --git a/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/ObjectExplorerUtils.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/ObjectExplorerUtils.cs new file mode 100644 index 00000000..7d32da10 --- /dev/null +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/ObjectExplorerUtils.cs @@ -0,0 +1,78 @@ +// +// 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 System.Threading; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; + +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer +{ + /// + /// Utility class for Object Explorer related operations + /// + public static class ObjectExplorerUtils + { + /// + /// Visitor that walks all nodes from the child to the root node, unless the + /// function indicates that this should stop traversing + /// + /// node to start traversing at + /// Predicate function that accesses the tree and + /// determines whether to stop going further up the tree + /// + /// boolean - true to continue navigating up the tree, false to end the loop + /// and return early + /// + public static bool VisitChildAndParents(TreeNode child, Predicate visitor) + { + if (child == null) + { + // End case: all nodes have been visited + return true; + } + + // Visit the child first, then go up the parents + if (!visitor(child)) + { + return false; + } + return VisitChildAndParents(child.Parent, visitor); + } + + /// + /// Finds a node by traversing the tree starting from the given node through all the children + /// + /// node to start traversing at + /// Predicate function that accesses the tree and + /// determines whether to stop going further up the tree + /// Predicate function to filter the children when traversing + /// A Tree Node that matches the condition, or null if no matching node could be found + public static TreeNode? FindNode(TreeNode node, Predicate condition, Predicate filter, bool expandIfNeeded = false, CancellationToken cancellationToken = new CancellationToken()) + { + if (node == null) + { + return null; + } + + if (condition(node)) + { + return node; + } + var children = expandIfNeeded && !node.IsAlwaysLeaf ? node.Expand(cancellationToken) : node.GetChildren(); + foreach (var child in children) + { + if (filter != null && filter(child)) + { + TreeNode? childNode = FindNode(child, condition, filter, expandIfNeeded); + if (childNode != null) + { + return childNode; + } + } + } + return null; + } + } +} diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/DatabaseTreeNode.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/DatabaseTreeNode.cs similarity index 94% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/DatabaseTreeNode.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/DatabaseTreeNode.cs index 285729cf..1923105c 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/DatabaseTreeNode.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/DatabaseTreeNode.cs @@ -3,21 +3,18 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - - using System; using System.Collections.Generic; using System.Globalization; using System.Threading; using Microsoft.SqlServer.Management.Common; using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; using Microsoft.SqlTools.Utility; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { - internal partial class DatabaseTreeNode + public partial class DatabaseTreeNode { public DatabaseTreeNode(ServerNode serverNode, string databaseName) : this() { @@ -55,7 +52,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } } - protected override void PopulateChildren(bool refresh, string name, CancellationToken cancellationToken, string? accessToken = null, IEnumerable? filters = null) + protected override void PopulateChildren(bool refresh, string name, CancellationToken cancellationToken, string? accessToken = null, IEnumerable? filters = null) { var smoQueryContext = this.GetContextAs(); if (IsAccessible(smoQueryContext)) diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/FolderNode.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/FolderNode.cs similarity index 88% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/FolderNode.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/FolderNode.cs index ede6aba9..50ab00d8 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/FolderNode.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/FolderNode.cs @@ -3,12 +3,10 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { /// /// Represents a folder node in the tree diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/NodePathGenerator.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/NodePathGenerator.cs similarity index 92% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/NodePathGenerator.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/NodePathGenerator.cs index 85caccbf..9758b4b4 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/NodePathGenerator.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/NodePathGenerator.cs @@ -3,14 +3,13 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System.Collections.Generic; using System.IO; using System.Linq; using System.Xml.Serialization; +using System.Reflection; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { public class NodePathGenerator { @@ -18,15 +17,15 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel private static Dictionary> NodeTypeDictionary { get; set; } - internal static void Initialize() + public static void Initialize() { if (TreeRoot != null) { return; } - var assembly = typeof(ObjectExplorerService).Assembly; - var resource = assembly.GetManifestResourceStream("Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel.SmoTreeNodesDefinition.xml"); + var assembly = Assembly.GetExecutingAssembly(); + var resource = assembly.GetManifestResourceStream("Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel.SmoTreeNodesDefinition.xml"); var serializer = new XmlSerializer(typeof(ServerExplorerTree)); NodeTypeDictionary = new Dictionary>(); using (var reader = new StreamReader(resource)) @@ -52,7 +51,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeTypeDictionary.Add("Server", serverSet); } - internal static HashSet FindNodePaths(ObjectExplorerService.ObjectExplorerSession objectExplorerSession, string typeName, string schema, string name, string databaseName, List parentNames = null) + public static HashSet FindNodePaths(IObjectExplorerSession objectExplorerSession, string typeName, string schema, string name, string databaseName, List parentNames = null) { if (TreeRoot == null) { @@ -85,7 +84,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel return returnSet; } - private static HashSet GenerateNodePath(ObjectExplorerService.ObjectExplorerSession objectExplorerSession, Node currentNode, string databaseName, List parentNames, string path) + private static HashSet GenerateNodePath(IObjectExplorerSession objectExplorerSession, Node currentNode, string databaseName, List parentNames, string path) { if (parentNames != null) { diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/ServerNode.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/ServerNode.cs similarity index 74% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/ServerNode.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/ServerNode.cs index 42c91156..f61d63af 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/ServerNode.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/ServerNode.cs @@ -3,47 +3,43 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System; using System.Globalization; using Microsoft.SqlServer.Management.Common; using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.Extensibility; -using Microsoft.SqlTools.ServiceLayer.Connection.Contracts; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; -using Microsoft.SqlTools.ServiceLayer.Utility; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; using Microsoft.SqlTools.Utility; +using Microsoft.SqlTools.Extensibility; +using Microsoft.SqlTools.SqlCore.Utility; +using System.IO; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { /// /// Server node implementation /// public class ServerNode : TreeNode { - private ConnectionSummary connectionSummary; - private ServerInfo serverInfo; + private ObjectExplorerServerInfo serverInfo; private Lazy context; private SmoWrapper smoWrapper; private SqlServerType sqlServerType; - private ServerConnection serverConnection; + public ServerConnection serverConnection; - public ServerNode(ConnectionCompleteParams connInfo, IMultiServiceProvider serviceProvider, ServerConnection serverConnection) + public ServerNode(ObjectExplorerServerInfo serverInfo, ServerConnection serverConnection, IMultiServiceProvider serviceProvider = null, Func groupBySchemaFlag = null) : base() { - Validate.IsNotNull(nameof(connInfo), connInfo); - Validate.IsNotNull("connInfo.ConnectionSummary", connInfo.ConnectionSummary); - Validate.IsNotNull(nameof(serviceProvider), serviceProvider); + Validate.IsNotNull(nameof(ObjectExplorerServerInfo), serverInfo); - this.connectionSummary = connInfo.ConnectionSummary; - this.serverInfo = connInfo.ServerInfo; + this.serverInfo = serverInfo; this.sqlServerType = ServerVersionHelper.CalculateServerType(this.serverInfo); - this.context = new Lazy(() => CreateContext(serviceProvider)); + var assembly = typeof(SqlCore.ObjectExplorer.SmoModel.SmoQuerier).Assembly; + serviceProvider ??= ExtensionServiceProvider.CreateFromAssembliesInDirectory(Path.GetDirectoryName(assembly.Location), new string[] { Path.GetFileName(assembly.Location) }); + this.context = new Lazy(() => CreateContext(serviceProvider, groupBySchemaFlag)); this.serverConnection = serverConnection; - NodeValue = connectionSummary.ServerName; + NodeValue = serverInfo.ServerName; IsAlwaysLeaf = false; NodeType = NodeTypes.Server.ToString(); NodeTypeId = NodeTypes.Server; @@ -68,7 +64,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel /// internal string GetConnectionLabel() { - string userName = connectionSummary.UserName; + string userName = serverInfo.UserName; // TODO Domain and username is not yet supported on .Net Core. // Consider passing as an input from the extension where this can be queried @@ -79,16 +75,16 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel // TODO Consider adding IsAuthenticatingDatabaseMaster check in the code and // referencing result here - if (!DatabaseUtils.IsSystemDatabaseConnection(connectionSummary.DatabaseName)) + if (!DatabaseUtils.IsSystemDatabaseConnection(serverInfo.DatabaseName)) { // We either have an azure with a database specified or a Denali database using a contained user if (string.IsNullOrWhiteSpace(userName)) { - userName = connectionSummary.DatabaseName; + userName = serverInfo.DatabaseName; } else { - userName += ", " + connectionSummary.DatabaseName; + userName += ", " + serverInfo.DatabaseName; } } @@ -98,7 +94,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel label = string.Format( CultureInfo.InvariantCulture, "{0} ({1} {2})", - connectionSummary.ServerName, + serverInfo.ServerName, "SQL Server", serverInfo.ServerVersion); } @@ -107,7 +103,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel label = string.Format( CultureInfo.InvariantCulture, "{0} ({1} {2} - {3})", - connectionSummary.ServerName, + serverInfo.ServerName, "SQL Server", serverInfo.ServerVersion, userName); @@ -118,7 +114,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel - private SmoQueryContext CreateContext(IMultiServiceProvider serviceProvider) + private SmoQueryContext CreateContext(IMultiServiceProvider serviceProvider, Func groupBySchemaFlag = null) { string exceptionMessage; @@ -127,7 +123,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel Server server = SmoWrapper.CreateServer(this.serverConnection); if (server != null) { - return new SmoQueryContext(server, serviceProvider, SmoWrapper) + return new SmoQueryContext(server, serviceProvider, SmoWrapper, groupBySchemaFlag) { Parent = server, SqlServerType = this.sqlServerType diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs similarity index 90% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs index bae61f72..1bfc47c9 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs @@ -1,356 +1,353 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.Linq; -using System.Threading; -using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; -using Microsoft.SqlTools.Utility; - -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel -{ - public class SmoChildFactoryBase : ChildFactory - { - private IEnumerable smoProperties; - - public override IEnumerable ApplicableParents() - { - return null; - } - - public override IEnumerable Expand(TreeNode parent, bool refresh, string name, bool includeSystemObjects, CancellationToken cancellationToken, IEnumerable? filters = null) - { - List allChildren = new List(); - - try - { - if (this.PutFoldersAfterNodes) - { - OnExpandPopulateNonFolders(allChildren, parent, refresh, name, cancellationToken, filters); - OnExpandPopulateFoldersAndFilter(allChildren, parent, includeSystemObjects); - RemoveFoldersFromInvalidSqlServerVersions(allChildren, parent); - } - else - { - OnExpandPopulateFoldersAndFilter(allChildren, parent, includeSystemObjects); - RemoveFoldersFromInvalidSqlServerVersions(allChildren, parent); - OnExpandPopulateNonFolders(allChildren, parent, refresh, name, cancellationToken, filters); - } - - OnBeginAsyncOperations(parent); - } - catch (Exception ex) - { - string error = string.Format(CultureInfo.InvariantCulture, "Failed expanding oe children. parent:{0} error:{1} inner:{2} stacktrace:{3}", - parent != null ? parent.GetNodePath() : "", ex.Message, ex.InnerException != null ? ex.InnerException.Message : "", ex.StackTrace); - Logger.Error(error); - throw; - } - - return allChildren; - } - - private void OnExpandPopulateFoldersAndFilter(List allChildren, TreeNode parent, bool includeSystemObjects) - { - SmoQueryContext context = parent.GetContextAs(); - OnExpandPopulateFolders(allChildren, parent); - if (!includeSystemObjects) - { - allChildren.RemoveAll(x => x.IsSystemObject); - } - - if (context != null && context.ValidFor != 0 && context.ValidFor != ValidForFlag.All) - { - allChildren.RemoveAll(x => - { - FolderNode folderNode = x as FolderNode; - if (folderNode != null && !ServerVersionHelper.IsValidFor(context.ValidFor, folderNode.ValidFor)) - { - return true; - } - return false; - }); - - // Remove the Dropped Ledger Columns folder if this isn't under a ledger table - allChildren.RemoveAll(x => - { - if (x.NodeTypeId == NodeTypes.DroppedLedgerColumns) - { - Table? parentTable = context.Parent as Table; - if (parentTable == null || - !(parentTable.LedgerType == LedgerTableType.UpdatableLedgerTable || - parentTable.LedgerType == LedgerTableType.AppendOnlyLedgerTable)) - { - return true; - } - } - return false; - }); - } - } - - /// - /// Populates any folders for a given parent node - /// - /// List to which nodes should be added - /// Parent the nodes are being added to - protected virtual void OnExpandPopulateFolders(IList allChildren, TreeNode parent) - { - } - - /// - /// Populates any non-folder nodes such as specific items in the tree. - /// - /// List to which nodes should be added - /// Parent the nodes are being added to - protected virtual void OnExpandPopulateNonFolders(IList allChildren, TreeNode parent, bool refresh, string name, CancellationToken cancellationToken, IEnumerable? appliedFilters = null) - { - Logger.Verbose(string.Format(CultureInfo.InvariantCulture, "child factory parent :{0}", parent.GetNodePath())); - - if (ChildQuerierTypes == null) - { - // This node does not support non-folder children - return; - } - SmoQueryContext context = parent.GetContextAs(); - Validate.IsNotNull(nameof(context), context); - - var serverValidFor = context.ValidFor; - if (ShouldFilterNode(parent, serverValidFor)) - { - return; - } - - IEnumerable queriers = context.ServiceProvider.GetServices(IsCompatibleQuerier); - var filters = this.Filters.ToList(); - var smoProperties = this.SmoProperties.Where(p => ServerVersionHelper.IsValidFor(serverValidFor, p.ValidFor)).Select(x => x.Name); - var filterDefinitions = parent.FilterProperties; - if (!string.IsNullOrEmpty(name)) - { - filters.Add(new NodePropertyFilter - { - Property = "Name", - Type = typeof(string), - Values = new List { name }, - }); - } - if (appliedFilters != null) - { - foreach (var f in appliedFilters) - { - NodeFilterProperty filterProperty = filterDefinitions.FirstOrDefault(x => x.Name == f.Name); - filters.Add(ObjectExplorerUtils.ConvertExpandNodeFilterToNodeFilter(f, filterProperty)); - } - } - - foreach (var querier in queriers) - { - cancellationToken.ThrowIfCancellationRequested(); - if (!querier.IsValidFor(serverValidFor)) - { - continue; - } - string propertyFilter = INodeFilter.GetPropertyFilter(filters, querier.GetType(), serverValidFor); - try - { - var smoObjectList = querier.Query(context, propertyFilter, refresh, smoProperties).ToList(); - foreach (var smoObject in smoObjectList) - { - cancellationToken.ThrowIfCancellationRequested(); - if (smoObject == null) - { - Logger.Error("smoObject should not be null"); - } - TreeNode childNode = CreateChild(parent, smoObject); - if (childNode != null && PassesFinalFilters(childNode, smoObject) && !ShouldFilterNode(childNode, serverValidFor)) - { - allChildren.Add(childNode); - } - } - - } - catch (Exception ex) - { - string error = string.Format(CultureInfo.InvariantCulture, "Failed getting smo objects. parent:{0} querier: {1} error:{2} inner:{3} stacktrace:{4}", - parent != null ? parent.GetNodePath() : "", querier.GetType(), ex.Message, ex.InnerException != null ? ex.InnerException.Message : "", ex.StackTrace); - Logger.Error(error); - throw; - } - } - } - - private bool ShouldFilterNode(TreeNode childNode, ValidForFlag validForFlag) - { - bool filterTheNode = false; - SmoTreeNode smoTreeNode = childNode as SmoTreeNode; - if (smoTreeNode != null) - { - if (!ServerVersionHelper.IsValidFor(validForFlag, smoTreeNode.ValidFor)) - { - filterTheNode = true; - } - } - - return filterTheNode; - } - - private bool IsCompatibleQuerier(SmoQuerier querier) - { - if (ChildQuerierTypes == null) - { - return false; - } - - Type actualType = querier.GetType(); - foreach (Type childType in ChildQuerierTypes) - { - // We will accept any querier that is compatible with the listed querier type - if (childType.IsAssignableFrom(actualType)) - { - return true; - } - } - return false; - - } - - /// - /// Filters out invalid folders if they cannot be displayed for the current server version - /// - /// List to which nodes should be added - /// Parent the nodes are being added to - protected virtual void RemoveFoldersFromInvalidSqlServerVersions(IList allChildren, TreeNode parent) - { - } - - // TODO Assess whether async operations node is required - protected virtual void OnBeginAsyncOperations(TreeNode parent) - { - } - - public override bool CanCreateChild(TreeNode parent, object context) - { - return false; - } - - public override TreeNode CreateChild(TreeNode parent, object context) - { - throw new NotImplementedException(); - } - - protected virtual void InitializeChild(TreeNode parent, TreeNode child, object context) - { - NamedSmoObject smoObj = context as NamedSmoObject; - if (smoObj == null) - { - Debug.WriteLine("context is not a NamedSmoObject. type: " + context.GetType()); - } - else - { - smoProperties = SmoProperties; - SmoTreeNode childAsMeItem = (SmoTreeNode)child; - childAsMeItem.CacheInfoFromModel(smoObj); - SmoQueryContext smoContext = parent.GetContextAs(); - - // If node has custom name, replaced it with the name already set - string customizedName = GetNodeCustomName(context, smoContext); - if (!string.IsNullOrEmpty(customizedName)) - { - childAsMeItem.NodeValue = customizedName; - childAsMeItem.NodePathName = GetNodePathName(context); - } - - childAsMeItem.NodeSubType = GetNodeSubType(context, smoContext); - childAsMeItem.NodeStatus = GetNodeStatus(context, smoContext); - } - } - - internal virtual Type[] ChildQuerierTypes - { - get - { - return null; - } - } - - public override IEnumerable Filters - { - get - { - return Enumerable.Empty(); - } - } - - public override IEnumerable SmoProperties - { - get - { - return Enumerable.Empty(); - } - } - - internal IEnumerable CachedSmoProperties - { - get - { - return smoProperties == null ? SmoProperties : smoProperties; - } - } - - /// - /// Returns true if any final validation of the object to be added passes, and false - /// if validation fails. This provides a chance to filter specific items out of a list - /// - /// - /// - /// boolean - public virtual bool PassesFinalFilters(TreeNode parent, object context) - { - return true; - } - - public override string GetNodeSubType(object smoObject, SmoQueryContext smoContext) - { - return string.Empty; - } - - public override string GetNodeStatus(object smoObject, SmoQueryContext smoContext) - { - return string.Empty; - } - - public static bool IsPropertySupported(string propertyName, SmoQueryContext context, NamedSmoObject smoObj, IEnumerable supportedProperties) - { - var property = supportedProperties.FirstOrDefault(x => string.Compare(x.Name, propertyName, StringComparison.InvariantCultureIgnoreCase) == 0); - if (property != null) - { - return ServerVersionHelper.IsValidFor(context.ValidFor, property.ValidFor); - } - else - { - // Return true if cannot find the proeprty, SMO still tries to get that property but adding the property to supported list can make loading the nodes faster - Logger.Verbose($"Smo property name {propertyName} for Smo type {smoObj.GetType()} is not added as supported properties. This can cause the performance of loading the OE nodes"); - return true; - } - } - - public override string GetNodeCustomName(object smoObject, SmoQueryContext smoContext) - { - return string.Empty; - } - - public override string GetNodePathName(object smoObject) - { - return (smoObject as NamedSmoObject).Name; - } - } -} +// +// 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 System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Linq; +using System.Threading; +using Microsoft.SqlServer.Management.Smo; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; +using Microsoft.SqlTools.Utility; + +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel +{ + public class SmoChildFactoryBase : ChildFactory + { + private IEnumerable smoProperties; + + public override IEnumerable ApplicableParents() + { + return null; + } + + public override IEnumerable Expand(TreeNode parent, bool refresh, string name, bool includeSystemObjects, CancellationToken cancellationToken, IEnumerable? filters = null) + { + List allChildren = new List(); + + try + { + if (this.PutFoldersAfterNodes) + { + OnExpandPopulateNonFolders(allChildren, parent, refresh, name, cancellationToken, filters); + OnExpandPopulateFoldersAndFilter(allChildren, parent, includeSystemObjects); + RemoveFoldersFromInvalidSqlServerVersions(allChildren, parent); + } + else + { + OnExpandPopulateFoldersAndFilter(allChildren, parent, includeSystemObjects); + RemoveFoldersFromInvalidSqlServerVersions(allChildren, parent); + OnExpandPopulateNonFolders(allChildren, parent, refresh, name, cancellationToken, filters); + } + + OnBeginAsyncOperations(parent); + } + catch (Exception ex) + { + string error = string.Format(CultureInfo.InvariantCulture, "Failed expanding oe children. parent:{0} error:{1} inner:{2} stacktrace:{3}", + parent != null ? parent.GetNodePath() : "", ex.Message, ex.InnerException != null ? ex.InnerException.Message : "", ex.StackTrace); + Logger.Error(error); + throw; + } + + return allChildren; + } + + private void OnExpandPopulateFoldersAndFilter(List allChildren, TreeNode parent, bool includeSystemObjects) + { + SmoQueryContext context = parent.GetContextAs(); + OnExpandPopulateFolders(allChildren, parent); + if (!includeSystemObjects) + { + allChildren.RemoveAll(x => x.IsSystemObject); + } + + if (context != null && context.ValidFor != 0 && context.ValidFor != ValidForFlag.All) + { + allChildren.RemoveAll(x => + { + FolderNode folderNode = x as FolderNode; + if (folderNode != null && !ServerVersionHelper.IsValidFor(context.ValidFor, folderNode.ValidFor)) + { + return true; + } + return false; + }); + + // Remove the Dropped Ledger Columns folder if this isn't under a ledger table + allChildren.RemoveAll(x => + { + if (x.NodeTypeId == NodeTypes.DroppedLedgerColumns) + { + Table? parentTable = context.Parent as Table; + if (parentTable == null || + !(parentTable.LedgerType == LedgerTableType.UpdatableLedgerTable || + parentTable.LedgerType == LedgerTableType.AppendOnlyLedgerTable)) + { + return true; + } + } + return false; + }); + } + } + + /// + /// Populates any folders for a given parent node + /// + /// List to which nodes should be added + /// Parent the nodes are being added to + protected virtual void OnExpandPopulateFolders(IList allChildren, TreeNode parent) + { + } + + /// + /// Populates any non-folder nodes such as specific items in the tree. + /// + /// List to which nodes should be added + /// Parent the nodes are being added to + protected virtual void OnExpandPopulateNonFolders(IList allChildren, TreeNode parent, bool refresh, string name, CancellationToken cancellationToken, IEnumerable? appliedFilters = null) + { + Logger.Verbose(string.Format(CultureInfo.InvariantCulture, "child factory parent :{0}", parent.GetNodePath())); + + if (this.GetChildQuerierTypes(parent) == null) + { + // This node does not support non-folder children + return; + } + SmoQueryContext context = parent.GetContextAs(); + Validate.IsNotNull(nameof(context), context); + + var serverValidFor = context.ValidFor; + if (ShouldFilterNode(parent, serverValidFor)) + { + return; + } + + IEnumerable queriers = context.ServiceProvider.GetServices((q) => IsCompatibleQuerier(q, parent)); + var filters = this.Filters.ToList(); + var smoProperties = this.SmoProperties.Where(p => ServerVersionHelper.IsValidFor(serverValidFor, p.ValidFor)).Select(x => x.Name); + if (!string.IsNullOrEmpty(name)) + { + filters.Add(new NodePropertyFilter + { + Property = "Name", + Type = typeof(string), + Values = new List { name }, + }); + } + if (appliedFilters != null) + { + filters.AddRange(appliedFilters); + } + + foreach (var querier in queriers) + { + cancellationToken.ThrowIfCancellationRequested(); + if (!querier.IsValidFor(serverValidFor)) + { + continue; + } + string propertyFilter = INodeFilter.GetPropertyFilter(filters, querier.GetType(), serverValidFor); + try + { + var smoObjectList = querier.Query(context, propertyFilter, refresh, smoProperties).ToList(); + foreach (var smoObject in smoObjectList) + { + cancellationToken.ThrowIfCancellationRequested(); + if (smoObject == null) + { + Logger.Error("smoObject should not be null"); + } + TreeNode childNode = CreateChild(parent, smoObject); + if (childNode != null && PassesFinalFilters(childNode, smoObject) && !ShouldFilterNode(childNode, serverValidFor)) + { + allChildren.Add(childNode); + } + } + + } + catch (Exception ex) + { + string error = string.Format(CultureInfo.InvariantCulture, "Failed getting smo objects. parent:{0} querier: {1} error:{2} inner:{3} stacktrace:{4}", + parent != null ? parent.GetNodePath() : "", querier.GetType(), ex.Message, ex.InnerException != null ? ex.InnerException.Message : "", ex.StackTrace); + Logger.Error(error); + throw; + } + } + } + + private bool ShouldFilterNode(TreeNode childNode, ValidForFlag validForFlag) + { + bool filterTheNode = false; + SmoTreeNode smoTreeNode = childNode as SmoTreeNode; + if (smoTreeNode != null) + { + if (!ServerVersionHelper.IsValidFor(validForFlag, smoTreeNode.ValidFor)) + { + filterTheNode = true; + } + } + + return filterTheNode; + } + + private bool IsCompatibleQuerier(SmoQuerier querier, TreeNode parent) + { + if (this.GetChildQuerierTypes(parent) == null) + { + return false; + } + + Type actualType = querier.GetType(); + foreach (Type childType in this.GetChildQuerierTypes(parent)) + { + // We will accept any querier that is compatible with the listed querier type + if (childType.IsAssignableFrom(actualType)) + { + return true; + } + } + return false; + + } + + /// + /// Filters out invalid folders if they cannot be displayed for the current server version + /// + /// List to which nodes should be added + /// Parent the nodes are being added to + protected virtual void RemoveFoldersFromInvalidSqlServerVersions(IList allChildren, TreeNode parent) + { + } + + // TODO Assess whether async operations node is required + protected virtual void OnBeginAsyncOperations(TreeNode parent) + { + } + + public override bool CanCreateChild(TreeNode parent, object context) + { + return false; + } + + public override TreeNode CreateChild(TreeNode parent, object context) + { + throw new NotImplementedException(); + } + + protected virtual void InitializeChild(TreeNode parent, TreeNode child, object context) + { + NamedSmoObject smoObj = context as NamedSmoObject; + if (smoObj == null) + { + Debug.WriteLine("context is not a NamedSmoObject. type: " + context.GetType()); + } + else + { + smoProperties = SmoProperties; + SmoTreeNode childAsMeItem = (SmoTreeNode)child; + childAsMeItem.CacheInfoFromModel(smoObj); + SmoQueryContext smoContext = parent.GetContextAs(); + + // If node has custom name, replaced it with the name already set + string customizedName = GetNodeCustomName(context, smoContext); + if (!string.IsNullOrEmpty(customizedName)) + { + childAsMeItem.NodeValue = customizedName; + childAsMeItem.NodePathName = GetNodePathName(context); + } + + childAsMeItem.NodeSubType = GetNodeSubType(context, smoContext); + childAsMeItem.NodeStatus = GetNodeStatus(context, smoContext); + } + } + + internal virtual Type[] ChildQuerierTypes + { + get + { + return null; + } + } + + public override IEnumerable Filters + { + get + { + return Enumerable.Empty(); + } + } + + public override IEnumerable SmoProperties + { + get + { + return Enumerable.Empty(); + } + } + + internal IEnumerable CachedSmoProperties + { + get + { + return smoProperties == null ? SmoProperties : smoProperties; + } + } + + protected virtual Type[] GetChildQuerierTypes(TreeNode parent) + { + return ChildQuerierTypes; + } + + /// + /// Returns true if any final validation of the object to be added passes, and false + /// if validation fails. This provides a chance to filter specific items out of a list + /// + /// + /// + /// boolean + public virtual bool PassesFinalFilters(TreeNode parent, object context) + { + return true; + } + + public override string GetNodeSubType(object smoObject, SmoQueryContext smoContext) + { + return string.Empty; + } + + public override string GetNodeStatus(object smoObject, SmoQueryContext smoContext) + { + return string.Empty; + } + + public static bool IsPropertySupported(string propertyName, SmoQueryContext context, NamedSmoObject smoObj, IEnumerable supportedProperties) + { + var property = supportedProperties.FirstOrDefault(x => string.Compare(x.Name, propertyName, StringComparison.InvariantCultureIgnoreCase) == 0); + if (property != null) + { + return ServerVersionHelper.IsValidFor(context.ValidFor, property.ValidFor); + } + else + { + // Return true if cannot find the proeprty, SMO still tries to get that property but adding the property to supported list can make loading the nodes faster + Logger.Verbose($"Smo property name {propertyName} for Smo type {smoObj.GetType()} is not added as supported properties. This can cause the performance of loading the OE nodes"); + return true; + } + } + + public override string GetNodeCustomName(object smoObject, SmoQueryContext smoContext) + { + return string.Empty; + } + + public override string GetNodePathName(object smoObject) + { + return (smoObject as NamedSmoObject).Name; + } + } +} diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoCollectionWrapper.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoCollectionWrapper.cs similarity index 95% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoCollectionWrapper.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoCollectionWrapper.cs index a887dd2f..9e95114a 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoCollectionWrapper.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoCollectionWrapper.cs @@ -3,14 +3,12 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System; using System.Collections; using System.Collections.Generic; using Microsoft.SqlServer.Management.Smo; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { /// /// Wrapper to convert non-generic Smo enumerables to generic enumerable types for easier use in diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoColumnCustomNode.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoColumnCustomNode.cs similarity index 98% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoColumnCustomNode.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoColumnCustomNode.cs index 5a25d356..bd234ed9 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoColumnCustomNode.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoColumnCustomNode.cs @@ -3,16 +3,14 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System; using System.Collections.Generic; using System.Globalization; using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; using Microsoft.SqlTools.Utility; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { /// /// Custom name for Columns diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoDatabaseCustomNode.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoDatabaseCustomNode.cs similarity index 97% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoDatabaseCustomNode.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoDatabaseCustomNode.cs index ad04e166..23854f1d 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoDatabaseCustomNode.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoDatabaseCustomNode.cs @@ -3,15 +3,13 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System.Collections.Generic; using Microsoft.SqlTools.Utility; using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; using System; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { /// /// Status for databases diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoExtensions.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoExtensions.cs similarity index 88% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoExtensions.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoExtensions.cs index cbc8003c..326f1a4f 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoExtensions.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoExtensions.cs @@ -3,11 +3,10 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.Connection; +using Microsoft.SqlTools.SqlCore.Connection; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { internal static class SmoExtensions { diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoKeyCustomNode.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoKeyCustomNode.cs similarity index 96% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoKeyCustomNode.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoKeyCustomNode.cs index 2b60fa92..b6e0b779 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoKeyCustomNode.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoKeyCustomNode.cs @@ -3,15 +3,13 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System; using System.Collections.Generic; using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; using Index = Microsoft.SqlServer.Management.Smo.Index; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { /// /// Subtye for keys diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoLoginCustomNode.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoLoginCustomNode.cs similarity index 90% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoLoginCustomNode.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoLoginCustomNode.cs index 896c47b7..e1be1200 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoLoginCustomNode.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoLoginCustomNode.cs @@ -3,14 +3,12 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System; using System.Collections.Generic; using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { /// /// Status for logins diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoParamterCustomNode.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoParamterCustomNode.cs similarity index 98% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoParamterCustomNode.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoParamterCustomNode.cs index 75c8f3f8..712c39ca 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoParamterCustomNode.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoParamterCustomNode.cs @@ -3,12 +3,10 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System.Globalization; using Microsoft.SqlServer.Management.Smo; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { /// /// Custom name for parameters diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQuerier.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoQuerier.cs similarity index 83% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQuerier.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoQuerier.cs index eb798152..b382ba74 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQuerier.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoQuerier.cs @@ -1,98 +1,87 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Data; -using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.Extensibility; - -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel -{ - /// - /// A handles SMO queries for one or more SMO object types. - /// The property defines which types can be queried. - /// - /// To query multiple - /// - public abstract class SmoQuerier : IComposableService - { - public abstract Type[] SupportedObjectTypes { get; } - private static object lockObject = new object(); - - /// - /// Queries SMO for a collection of objects using the - /// - /// - /// - public abstract IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties); - - internal IMultiServiceProvider ServiceProvider - { - get; - private set; - } - - public void SetServiceProvider(IMultiServiceProvider provider) - { - ServiceProvider = provider; - } - - /// - /// Convert the data to data reader is possible - /// - protected IDataReader GetDataReader(object data) - { - IDataReader reader = null; - if (data is IDataReader) - { - - reader = data as IDataReader; - } - else if(data is DataTable) - { - reader = ((DataTable)data).CreateDataReader(); - } - - else if (data is DataSet) - { - reader = ((DataSet)data).Tables[0].CreateDataReader(); - } - - return reader; - } - - /// - /// Mthod used to do custom filtering on smo objects if cannot be implemented using the filters - /// - protected virtual bool PassesFinalFilters(SqlSmoObject parent, SqlSmoObject smoObject) - { - return true; - } - - /// - /// Returns true if the querier is valid for the given server version - /// - /// - /// - public bool IsValidFor(ValidForFlag serverValidFor) - { - return ServerVersionHelper.IsValidFor(serverValidFor, ValidFor); - } - - /// - /// Indicates which platforms the querier is valid for - /// - public virtual ValidForFlag ValidFor - { - get - { - return ValidForFlag.All; - } - } - } -} +// +// 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 System.Collections.Generic; +using System.Data; +using Microsoft.SqlServer.Management.Smo; +using Microsoft.SqlTools.Extensibility; + +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel +{ + /// + /// A handles SMO queries for one or more SMO object types. + /// The property defines which types can be queried. + /// + /// To query multiple + /// + public abstract class SmoQuerier : IComposableService + { + public abstract Type[] SupportedObjectTypes { get; } + private static object lockObject = new object(); + + /// + /// Queries SMO for a collection of objects using the + /// + /// + /// + public abstract IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties); + + internal IMultiServiceProvider ServiceProvider + { + get; + private set; + } + + public void SetServiceProvider(IMultiServiceProvider provider) + { + ServiceProvider = provider; + } + + /// + /// Convert the data to data reader is possible + /// + protected IDataReader GetDataReader(object data) + { + IDataReader reader = null; + if (data is IDataReader) + { + + reader = data as IDataReader; + } + else if(data is DataTable) + { + reader = ((DataTable)data).CreateDataReader(); + } + + else if (data is DataSet) + { + reader = ((DataSet)data).Tables[0].CreateDataReader(); + } + + return reader; + } + + /// + /// Mthod used to do custom filtering on smo objects if cannot be implemented using the filters + /// + protected virtual bool PassesFinalFilters(SqlSmoObject parent, SqlSmoObject smoObject) => true; + + /// + /// Returns true if the querier is valid for the given server version + /// + /// + /// + public bool IsValidFor(ValidForFlag serverValidFor) => ServerVersionHelper.IsValidFor(serverValidFor, ValidFor); + + /// + /// Indicates which platforms the querier is valid for + /// + public virtual ValidForFlag ValidFor + { + get => ValidForFlag.All; + } + } +} diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryContext.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoQueryContext.cs similarity index 83% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryContext.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoQueryContext.cs index c5430046..c4deb250 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryContext.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoQueryContext.cs @@ -3,14 +3,12 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System; using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlTools.Extensibility; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { /// /// Context object containing key properties needed to query for SMO objects @@ -22,21 +20,23 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel private SmoObjectBase parent; private SmoWrapper smoWrapper; private ValidForFlag validFor = 0; + private Func groupBySchemaFlag; /// /// Creates a context object with a server to use as the basis for any queries /// /// - public SmoQueryContext(Server server, IMultiServiceProvider serviceProvider) - : this(server, serviceProvider, null) + public SmoQueryContext(Server server, IMultiServiceProvider serviceProvider, Func groupBySchemaFlag = null) + : this(server, serviceProvider, null, groupBySchemaFlag) { } - internal SmoQueryContext(Server server, IMultiServiceProvider serviceProvider, SmoWrapper serverManager) + internal SmoQueryContext(Server server, IMultiServiceProvider serviceProvider, SmoWrapper serverManager, Func groupBySchemaFlag = null) { this.server = server; ServiceProvider = serviceProvider; this.smoWrapper = serverManager ?? new SmoWrapper(); + this.groupBySchemaFlag = groupBySchemaFlag ?? new Func(() => false); } /// @@ -85,6 +85,11 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } } + public bool GroupBySchema + { + get => groupBySchemaFlag(); + } + /// /// A query loader that can be used to find objects /// for specific SMO types @@ -102,26 +107,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel return Parent as T; } - /// - /// Gets the if available, by looking it up - /// from the - /// - /// - /// - /// Thrown if the is not set or the - /// isn't available from that provider - /// - public ObjectExplorerService GetObjectExplorerService() - { - if (ServiceProvider == null) - { - throw new InvalidOperationException(SR.ServiceProviderNotSet); - } - - return ServiceProvider.GetService() - ?? throw new InvalidOperationException(SR.ServiceNotFound(nameof(ObjectExplorerService))); - } - /// /// Copies the context for use by another node /// @@ -129,7 +114,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel /// new with all fields except the same public SmoQueryContext CopyWithParent(SmoObjectBase parent) { - SmoQueryContext context = new SmoQueryContext(this.Server, this.ServiceProvider, this.smoWrapper) + SmoQueryContext context = new SmoQueryContext(this.Server, this.ServiceProvider, this.smoWrapper, this.groupBySchemaFlag) { database = this.Database, Parent = parent, diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoQueryModel.cs similarity index 99% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoQueryModel.cs index 7a6c311a..3c9bc5eb 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoQueryModel.cs @@ -3,8 +3,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - // This file was generated by a T4 Template. Do not modify directly, instead update the SmoQueryModelDefinition.xml file // and re-run the T4 template. This can be done in Visual Studio by right-click in and choosing "Run Custom Tool", // or from the command-line on any platform by running "build.cmd -Target=CodeGen" or "build.sh -Target=CodeGen". @@ -15,11 +13,11 @@ using System.Composition; using System.Linq; using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlServer.Management.Smo.Broker; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; using Microsoft.SqlTools.Utility; using Index = Microsoft.SqlServer.Management.Smo.Index; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { [Export(typeof(SmoQuerier))] diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.tt b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoQueryModel.tt similarity index 98% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.tt rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoQueryModel.tt index 38ad407a..8daa5937 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.tt +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoQueryModel.tt @@ -12,8 +12,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - // This file was generated by a T4 Template. Do not modify directly, instead update the SmoQueryModelDefinition.xml file // and re-run the T4 template. This can be done in Visual Studio by right-click in and choosing "Run Custom Tool", // or from the command-line on any platform by running "build.cmd -Target=CodeGen" or "build.sh -Target=CodeGen". @@ -24,11 +22,11 @@ using System.Composition; using System.Linq; using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlServer.Management.Smo.Broker; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; using Microsoft.SqlTools.Utility; using Index = Microsoft.SqlServer.Management.Smo.Index; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { <# var directory = Path.GetDirectoryName(Host.TemplateFile); diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModelDefinition.xml b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoQueryModelDefinition.xml similarity index 100% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModelDefinition.xml rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoQueryModelDefinition.xml diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTableCustomNode.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTableCustomNode.cs similarity index 98% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTableCustomNode.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTableCustomNode.cs index 2af54979..81225b00 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTableCustomNode.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTableCustomNode.cs @@ -3,11 +3,9 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using Microsoft.SqlServer.Management.Smo; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { /// /// Custom name for table diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNode.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTreeNode.cs similarity index 88% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNode.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTreeNode.cs index 4b5c6d42..f24544ca 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNode.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTreeNode.cs @@ -1,127 +1,123 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -#nullable disable - -using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; - -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel -{ - /// - /// A Node in the tree representing a SMO-based object - /// - public class SmoTreeNode : TreeNode - { - public static int FolderSortPriority = 0; - private static int _nextSortPriority = FolderSortPriority + 1; // 0 is reserved for folders - - protected SmoQueryContext context; - - public SmoTreeNode() : base() - { - } - - protected virtual void OnInitialize() - { - // TODO setup initialization - } - - /// - /// Is this a system (MSShipped) object? - /// - public bool IsMsShippedOwned { get; set; } - - /// - /// Indicates which platforms a node is valid for - /// - public ValidForFlag ValidFor { get; set; } - - /// - /// Gets an incrementing sort priority value to assist in automatically sorting - /// elements in a tree - /// - public static int NextSortPriority - { - get - { - return System.Threading.Interlocked.Increment(ref _nextSortPriority); - } - } - - public NamedSmoObject SmoObject { get; private set; } - - public virtual void CacheInfoFromModel(NamedSmoObject smoObject) - { - SmoObject = smoObject; - NodeValue = smoObject.Name; - ScriptSchemaObjectBase schemaBaseObject = smoObject as ScriptSchemaObjectBase; - ObjectMetadata = new Metadata.Contracts.ObjectMetadata(); - ObjectMetadata.Name = smoObject.Name; - - try - { - if (smoObject.Urn != null) - { - ObjectMetadata.Urn = smoObject.Urn.Value; - ObjectMetadata.MetadataTypeName = smoObject.Urn.Type; - } - } - catch - { - //Ignore the exception, sometimes the urn returns exception and I' not sure why - } - - if (schemaBaseObject != null) - { - ObjectMetadata.Schema = schemaBaseObject.Schema; - if (!string.IsNullOrEmpty(ObjectMetadata.Schema)) - { - NodeValue = $"{ObjectMetadata.Schema}.{smoObject.Name}"; - } - } - else - { - // Try to read the schema from the parent object - var parent = smoObject?.ParentCollection?.ParentInstance as ScriptSchemaObjectBase; - if (parent != null) - { - ObjectMetadata.Schema = parent.Schema; - ObjectMetadata.ParentName = parent.Name; - ObjectMetadata.ParentTypeName = parent.Urn.Type; - } - } - } - - public virtual NamedSmoObject GetParentSmoObject() - { - if (SmoObject != null) - { - return SmoObject; - } - // Return the parent's object, or null if it's not set / not a SmoTreeNode - return ParentAs()?.GetParentSmoObject(); - } - - public override object GetContext() - { - EnsureContextInitialized(); - return context; - } - - protected virtual void EnsureContextInitialized() - { - if (context == null) - { - SmoObjectBase smoParent = GetParentSmoObject(); - SmoQueryContext parentContext = Parent?.GetContextAs(); - if (smoParent != null && parentContext != null) - { - context = parentContext.CopyWithParent(smoParent); - } - } - } - } -} +// +// 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.Smo; +using Microsoft.SqlTools.SqlCore.Metadata; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; + +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel +{ + /// + /// A Node in the tree representing a SMO-based object + /// + public class SmoTreeNode : TreeNode + { + public static int FolderSortPriority = 0; + private static int _nextSortPriority = FolderSortPriority + 1; // 0 is reserved for folders + + protected SmoQueryContext context; + + public SmoTreeNode() : base() + { + } + + protected virtual void OnInitialize() + { + // TODO setup initialization + } + + /// + /// Is this a system (MSShipped) object? + /// + public bool IsMsShippedOwned { get; set; } + + /// + /// Indicates which platforms a node is valid for + /// + public ValidForFlag ValidFor { get; set; } + + /// + /// Gets an incrementing sort priority value to assist in automatically sorting + /// elements in a tree + /// + public static int NextSortPriority + { + get => System.Threading.Interlocked.Increment(ref _nextSortPriority); + } + + public NamedSmoObject SmoObject { get; private set; } + + public virtual void CacheInfoFromModel(NamedSmoObject smoObject) + { + SmoObject = smoObject; + NodeValue = smoObject.Name; + ScriptSchemaObjectBase schemaBaseObject = smoObject as ScriptSchemaObjectBase; + ObjectMetadata = new ObjectMetadata(); + ObjectMetadata.Name = smoObject.Name; + + try + { + if (smoObject.Urn != null) + { + ObjectMetadata.Urn = smoObject.Urn.Value; + ObjectMetadata.MetadataTypeName = smoObject.Urn.Type; + } + } + catch + { + //Ignore the exception, sometimes the urn returns exception and I' not sure why + } + + if (schemaBaseObject != null) + { + ObjectMetadata.Schema = schemaBaseObject.Schema; + if (!string.IsNullOrEmpty(ObjectMetadata.Schema)) + { + NodeValue = $"{ObjectMetadata.Schema}.{smoObject.Name}"; + } + } + else + { + // Try to read the schema from the parent object + var parent = smoObject?.ParentCollection?.ParentInstance as ScriptSchemaObjectBase; + if (parent != null) + { + ObjectMetadata.Schema = parent.Schema; + ObjectMetadata.ParentName = parent.Name; + ObjectMetadata.ParentTypeName = parent.Urn.Type; + } + } + } + + public virtual NamedSmoObject GetParentSmoObject() + { + if (SmoObject != null) + { + return SmoObject; + } + // Return the parent's object, or null if it's not set / not a SmoTreeNode + return ParentAs()?.GetParentSmoObject(); + } + + public override object GetContext() + { + EnsureContextInitialized(); + return context; + } + + protected virtual void EnsureContextInitialized() + { + if (context == null) + { + SmoObjectBase smoParent = GetParentSmoObject(); + SmoQueryContext parentContext = Parent?.GetContextAs(); + if (smoParent != null && parentContext != null) + { + context = parentContext.CopyWithParent(smoParent); + } + } + } + } +} diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodes.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTreeNodes.cs similarity index 98% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodes.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTreeNodes.cs index 0812f902..b1bc9d13 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodes.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTreeNodes.cs @@ -3,8 +3,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - // This file was generated by a T4 Template. Do not modify directly, instead update the SmoTreeNodesDefinition.xml file // and re-run the T4 template. This can be done in Visual Studio by right-click in and choosing "Run Custom Tool", // or from the command-line on any platform by running "build.cmd -Target=CodeGen" or "build.sh -Target=CodeGen". @@ -13,47 +11,23 @@ using System; using System.Collections.Generic; using System.Composition; using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts; -using Microsoft.SqlTools.ServiceLayer.SqlContext; -using Microsoft.SqlTools.ServiceLayer.Workspace; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; - -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { - internal sealed partial class DatabaseTreeNode : SmoTreeNode + public partial class DatabaseTreeNode : SmoTreeNode { public DatabaseTreeNode() : base() { NodeValue = string.Empty; this.NodeType = "Database"; this.NodeTypeId = NodeTypes.Database; - if(WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer.GroupBySchema) - { - this.FilterProperties = new NodeFilterProperty[] - { - new NodeFilterProperty - { - Name = "Name", - DisplayName = SR.FilterName, - Type = NodeFilterPropertyDataType.String, - Description = SR.FilterNameDescription, - }, - new NodeFilterProperty - { - Name = "Owner", - DisplayName = SR.FilterOwner, - Type = NodeFilterPropertyDataType.String, - Description = SR.FilterOwnerDescription, - }, - }; - } OnInitialize(); } } - internal sealed partial class TableTreeNode : SmoTreeNode + public partial class TableTreeNode : SmoTreeNode { public TableTreeNode() : base() { @@ -64,7 +38,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } } - internal sealed partial class ViewTreeNode : SmoTreeNode + public partial class ViewTreeNode : SmoTreeNode { public ViewTreeNode() : base() { @@ -75,7 +49,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } } - internal sealed partial class UserDefinedTableTypeTreeNode : SmoTreeNode + public partial class UserDefinedTableTypeTreeNode : SmoTreeNode { public UserDefinedTableTypeTreeNode() : base() { @@ -86,7 +60,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } } - internal sealed partial class StoredProcedureTreeNode : SmoTreeNode + public partial class StoredProcedureTreeNode : SmoTreeNode { public StoredProcedureTreeNode() : base() { @@ -97,7 +71,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } } - internal sealed partial class TableValuedFunctionTreeNode : SmoTreeNode + public partial class TableValuedFunctionTreeNode : SmoTreeNode { public TableValuedFunctionTreeNode() : base() { @@ -108,7 +82,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } } - internal sealed partial class ScalarValuedFunctionTreeNode : SmoTreeNode + public partial class ScalarValuedFunctionTreeNode : SmoTreeNode { public ScalarValuedFunctionTreeNode() : base() { @@ -119,7 +93,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } } - internal sealed partial class AggregateFunctionTreeNode : SmoTreeNode + public partial class AggregateFunctionTreeNode : SmoTreeNode { public AggregateFunctionTreeNode() : base() { @@ -130,7 +104,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } } - internal sealed partial class FileGroupTreeNode : SmoTreeNode + public partial class FileGroupTreeNode : SmoTreeNode { public FileGroupTreeNode() : base() { @@ -141,7 +115,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } } - internal sealed partial class ExternalTableTreeNode : SmoTreeNode + public partial class ExternalTableTreeNode : SmoTreeNode { public ExternalTableTreeNode() : base() { @@ -152,7 +126,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } } - internal sealed partial class ExternalResourceTreeNode : SmoTreeNode + public partial class ExternalResourceTreeNode : SmoTreeNode { public ExternalResourceTreeNode() : base() { @@ -163,7 +137,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } } - internal sealed partial class HistoryTableTreeNode : SmoTreeNode + public partial class HistoryTableTreeNode : SmoTreeNode { public HistoryTableTreeNode() : base() { @@ -174,7 +148,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } } - internal sealed partial class ExpandableSchemaTreeNode : SmoTreeNode + public partial class ExpandableSchemaTreeNode : SmoTreeNode { public ExpandableSchemaTreeNode() : base() { @@ -303,6 +277,26 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { var child = new DatabaseTreeNode(); InitializeChild(parent, child, context); + if((parent.GetContext() as SmoQueryContext).GroupBySchema) + { + child.FilterProperties = new NodeFilterProperty[] + { + new NodeFilterProperty + { + Name = "Name", + DisplayName = SR.FilterName, + Type = NodeFilterPropertyDataType.String, + Description = SR.FilterNameDescription, + }, + new NodeFilterProperty + { + Name = "Owner", + DisplayName = SR.FilterOwner, + Type = NodeFilterPropertyDataType.String, + Description = SR.FilterOwnerDescription, + }, + }; + } return child; } } @@ -444,6 +438,26 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { var child = new DatabaseTreeNode(); InitializeChild(parent, child, context); + if((parent.GetContext() as SmoQueryContext).GroupBySchema) + { + child.FilterProperties = new NodeFilterProperty[] + { + new NodeFilterProperty + { + Name = "Name", + DisplayName = SR.FilterName, + Type = NodeFilterPropertyDataType.String, + Description = SR.FilterNameDescription, + }, + new NodeFilterProperty + { + Name = "Owner", + DisplayName = SR.FilterOwner, + Type = NodeFilterPropertyDataType.String, + Description = SR.FilterOwnerDescription, + }, + }; + } return child; } } @@ -769,7 +783,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel protected override void OnExpandPopulateFolders(IList currentChildren, TreeNode parent) { - if (!WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer.GroupBySchema) + if (!(parent.GetContext() as SmoQueryContext).GroupBySchema) { currentChildren.Add(new FolderNode { NodeValue = SR.SchemaHierarchy_Tables, @@ -833,7 +847,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } }); } - if (!WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer.GroupBySchema) + if (!(parent.GetContext() as SmoQueryContext).GroupBySchema) { currentChildren.Add(new FolderNode { NodeValue = SR.SchemaHierarchy_Views, @@ -873,7 +887,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } }); } - if (!WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer.GroupBySchema) + if (!(parent.GetContext() as SmoQueryContext).GroupBySchema) { currentChildren.Add(new FolderNode { NodeValue = SR.SchemaHierarchy_Synonyms, @@ -883,7 +897,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel SortPriority = SmoTreeNode.NextSortPriority, }); } - if (WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer.GroupBySchema) + if ((parent.GetContext() as SmoQueryContext).GroupBySchema) { currentChildren.Add(new FolderNode { NodeValue = SR.SchemaHierarchy_BuiltInSchema, @@ -928,19 +942,17 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel }); } - internal override Type[] ChildQuerierTypes + protected override Type[] GetChildQuerierTypes(TreeNode parent) { - get - { - List conditionalTypesList = new List(); - if (WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer.GroupBySchema) - { - conditionalTypesList.Add(typeof(SqlSchemaQuerier)); - } - return conditionalTypesList.ToArray(); - } + List conditionalTypesList = new List(); + if ((parent.GetContext() as SmoQueryContext).GroupBySchema) + { + conditionalTypesList.Add(typeof(SqlSchemaQuerier)); + } + return conditionalTypesList.ToArray(); } + public override TreeNode CreateChild(TreeNode parent, object context) { var child = new ExpandableSchemaTreeNode(); @@ -1557,7 +1569,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel protected override void OnExpandPopulateFolders(IList currentChildren, TreeNode parent) { - if (!WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer.GroupBySchema) + if (!(parent.GetContext() as SmoQueryContext).GroupBySchema) { currentChildren.Add(new FolderNode { NodeValue = SR.SchemaHierarchy_StoredProcedures, @@ -1604,7 +1616,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } }); } - if (!WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer.GroupBySchema) + if (!(parent.GetContext() as SmoQueryContext).GroupBySchema) { currentChildren.Add(new FolderNode { NodeValue = SR.SchemaHierarchy_Functions, @@ -1628,7 +1640,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel ValidFor = ValidForFlag.AllOnPrem|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); - if (!WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer.GroupBySchema) + if (!(parent.GetContext() as SmoQueryContext).GroupBySchema) { currentChildren.Add(new FolderNode { NodeValue = SR.SchemaHierarchy_Types, @@ -1638,7 +1650,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel SortPriority = SmoTreeNode.NextSortPriority, }); } - if (!WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer.GroupBySchema) + if (!(parent.GetContext() as SmoQueryContext).GroupBySchema) { currentChildren.Add(new FolderNode { NodeValue = SR.SchemaHierarchy_Sequences, diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodes.tt b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTreeNodes.tt similarity index 89% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodes.tt rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTreeNodes.tt index 09ed4604..e401f036 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodes.tt +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTreeNodes.tt @@ -14,8 +14,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - // This file was generated by a T4 Template. Do not modify directly, instead update the SmoTreeNodesDefinition.xml file // and re-run the T4 template. This can be done in Visual Studio by right-click in and choosing "Run Custom Tool", // or from the command-line on any platform by running "build.cmd -Target=CodeGen" or "build.sh -Target=CodeGen". @@ -24,13 +22,9 @@ using System; using System.Collections.Generic; using System.Composition; using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts; -using Microsoft.SqlTools.ServiceLayer.SqlContext; -using Microsoft.SqlTools.ServiceLayer.Workspace; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; - -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { <# @@ -79,76 +73,13 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { var name = TreeNode.GetAttribute("Name"); var type = !string.IsNullOrWhiteSpace(TreeNode.GetAttribute("Type")) ? TreeNode.GetAttribute("Type") : TreeNode.GetAttribute("Name"); - WriteLine(" internal sealed partial class {0} : SmoTreeNode", name); + WriteLine(" public partial class {0} : SmoTreeNode", name); WriteLine(" {"); WriteLine(" public {0}() : base()", name); WriteLine(" {"); WriteLine(" NodeValue = string.Empty;"); WriteLine(" this.NodeType = \"{0}\";", type.Replace("TreeNode", string.Empty)); WriteLine(" this.NodeTypeId = NodeTypes.{0};", name.Replace("TreeNode", string.Empty)); - List filterProperties = GetFilterProperties(xmlFile, type.Replace("TreeNode", string.Empty)); - string settingsFlag = GetFilterSettingsFlag(xmlFile, type.Replace("TreeNode", string.Empty)); - if(!String.IsNullOrEmpty(settingsFlag)) - { - WriteLine(" if({0})", GetSettingsString(settingsFlag)); - WriteLine(" {"); - } - if(filterProperties.Count > 0){ - WriteLine(" this.FilterProperties = new NodeFilterProperty[]"); - WriteLine(" {"); - foreach (var filterDef in filterProperties) - { - var filterName = filterDef.GetAttribute("Name"); - var filterDisplayName = filterDef.GetAttribute("LocLabel"); - var filterType = filterDef.GetAttribute("Type"); - var enumString = "NodeFilterPropertyDataType"; - switch (filterType) - { - case "string": - enumString += ".String"; - break; - case "bool": - enumString += ".Boolean"; - break; - case "date": - enumString += ".Date"; - break; - case "choice": - enumString += ".Choice"; - break; - } - var filterDescription = filterDef.GetAttribute("Description"); - WriteLine(" new NodeFilterProperty"); - WriteLine(" {"); - WriteLine(" Name = \"{0}\",", filterName); - WriteLine(" DisplayName = {0},", filterDisplayName); - WriteLine(" Type = {0},", enumString); - WriteLine(" Description = {0},", filterDescription); - if(filterType == "choice") - { - var choiceValues = filterDef.ChildNodes; - WriteLine(" Choices = new NodeFilterPropertyChoice[] {"); - foreach (XmlElement choice in choiceValues) - { - var choiceName = choice.GetAttribute("LocLabel"); - var choiceValue = choice.GetAttribute("Value"); - WriteLine(" new NodeFilterPropertyChoice {"); - WriteLine(" DisplayName = {0},", choiceName); - WriteLine(" Value = \"{0}\",", choiceValue); - WriteLine(" },"); - - } - WriteLine(" }"); - } - WriteLine(" },"); - - } - WriteLine(" };"); - } - if(!String.IsNullOrEmpty(settingsFlag)) - { - WriteLine(" }"); - } WriteLine(" OnInitialize();"); WriteLine(" }"); WriteLine(" }"); @@ -435,11 +366,10 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if(ConditionalChildQuerierTypes.Count > 0) { WriteLine(""); - WriteLine(" internal override Type[] ChildQuerierTypes"); + WriteLine(" protected override Type[] GetChildQuerierTypes(TreeNode parent)"); WriteLine(" {"); - WriteLine(" get"); - WriteLine(" {"); - WriteLine(" List conditionalTypesList = new List();"); + + WriteLine(" List conditionalTypesList = new List();"); foreach(XmlElement Querier in ConditionalChildQuerierTypes) { var settingsFlag = Querier.GetAttribute("SettingsFlag"); @@ -447,20 +377,20 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if(!string.IsNullOrEmpty(settingsFlag)) { - WriteLine(" if ({0})", GetSettingsString(settingsFlag)); - WriteLine(" {"); - WriteLine(" conditionalTypesList.Add(typeof({0}Querier));", QuerierName); - WriteLine(" }"); + WriteLine(" if ({0})", GetSettingsString(settingsFlag)); + WriteLine(" {"); + WriteLine(" conditionalTypesList.Add(typeof({0}Querier));", QuerierName); + WriteLine(" }"); } else { - WriteLine(" conditionalTypesList.Add(typeof({0}Querier));", QuerierName); + WriteLine(" conditionalTypesList.Add(typeof({0}Querier));", QuerierName); } } - WriteLine(" return conditionalTypesList.ToArray();"); - WriteLine(" }"); + WriteLine(" return conditionalTypesList.ToArray();"); WriteLine(" }"); - } + WriteLine(""); + } else { string[] allTypes = ChildQuerierTypes.Split(new [] { ';' }, StringSplitOptions.RemoveEmptyEntries); @@ -514,6 +444,67 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel WriteLine(" child.SortPriority = SmoTreeNode.NextSortPriority;"); } WriteLine(" InitializeChild(parent, child, context);"); + + List filterProperties = GetFilterProperties(xmlFile, TreeNode.Replace("TreeNode", string.Empty)); + string filterFlag = GetFilterSettingsFlag(xmlFile, TreeNode.Replace("TreeNode", string.Empty)); + if(!String.IsNullOrEmpty(filterFlag)) + { + WriteLine(" if((parent.GetContext() as SmoQueryContext).{0})", filterFlag); + WriteLine(" {"); + } + if(filterProperties.Count > 0){ + WriteLine(" child.FilterProperties = new NodeFilterProperty[]"); + WriteLine(" {"); + foreach (var filterDef in filterProperties) + { + var filterName = filterDef.GetAttribute("Name"); + var filterDisplayName = filterDef.GetAttribute("LocLabel"); + var filterType = filterDef.GetAttribute("Type"); + var enumString = "NodeFilterPropertyDataType"; + switch (filterType) + { + case "string": + enumString += ".String"; + break; + case "bool": + enumString += ".Boolean"; + break; + case "date": + enumString += ".Date"; + break; + case "choice": + enumString += ".Choice"; + break; + } + var filterDescription = filterDef.GetAttribute("Description"); + WriteLine(" new NodeFilterProperty"); + WriteLine(" {"); + WriteLine(" Name = \"{0}\",", filterName); + WriteLine(" DisplayName = {0},", filterDisplayName); + WriteLine(" Type = {0},", enumString); + WriteLine(" Description = {0},", filterDescription); + if(filterType == "choice") + { + var choiceValues = filterDef.ChildNodes; + WriteLine(" Choices = new NodeFilterPropertyChoice[] {"); + foreach (XmlElement choice in choiceValues) + { + var choiceName = choice.GetAttribute("LocLabel"); + var choiceValue = choice.GetAttribute("Value"); + WriteLine(" new NodeFilterPropertyChoice {"); + WriteLine(" DisplayName = {0},", choiceName); + WriteLine(" Value = \"{0}\",", choiceValue); + WriteLine(" },"); + + } + WriteLine(" }"); + } + WriteLine(" },"); + + } + WriteLine(" };"); + WriteLine(" }"); + } WriteLine(" return child;"); WriteLine(" }"); } @@ -849,6 +840,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel notOperator = "!"; settingsName = settingsName.Substring(1, settingsName.Length-1); } - return String.Format("{0}WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer.{1}", notOperator, settingsName); + return String.Format("{0}(parent.GetContext() as SmoQueryContext).{1}", notOperator, settingsName); } #> \ No newline at end of file diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodesDefinition.xml b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTreeNodesDefinition.xml similarity index 99% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodesDefinition.xml rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTreeNodesDefinition.xml index be6f3b1f..3b5b2d77 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodesDefinition.xml +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTreeNodesDefinition.xml @@ -677,4 +677,3 @@ - diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTriggerCustomNode.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTriggerCustomNode.cs similarity index 95% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTriggerCustomNode.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTriggerCustomNode.cs index 353ca1f9..0ca50d69 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTriggerCustomNode.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoTriggerCustomNode.cs @@ -3,14 +3,12 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System; using System.Collections.Generic; using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { /// /// Status for triggers diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoUserCustomNode.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoUserCustomNode.cs similarity index 90% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoUserCustomNode.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoUserCustomNode.cs index e5130c4f..24873d05 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoUserCustomNode.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoUserCustomNode.cs @@ -3,14 +3,12 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System; using System.Collections.Generic; using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { /// /// Status for logins diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoViewCustomNode.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoViewCustomNode.cs similarity index 97% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoViewCustomNode.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoViewCustomNode.cs index 274e15ee..1a9b90c6 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoViewCustomNode.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoViewCustomNode.cs @@ -3,11 +3,10 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable using Microsoft.SqlServer.Management.Smo; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { /// /// Custom name for view diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoWrapper.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoWrapper.cs similarity index 96% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoWrapper.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoWrapper.cs index be59f52e..217443a8 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoWrapper.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoWrapper.cs @@ -3,12 +3,10 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using Microsoft.SqlServer.Management.Common; using Microsoft.SqlServer.Management.Smo; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { /// /// Internal for testing purposes only. This class provides wrapper functionality diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SqlHistoryTableQuerier.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SqlHistoryTableQuerier.cs similarity index 92% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SqlHistoryTableQuerier.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SqlHistoryTableQuerier.cs index 2b54654b..2c306979 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SqlHistoryTableQuerier.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SqlHistoryTableQuerier.cs @@ -3,12 +3,10 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System; using Microsoft.SqlServer.Management.Smo; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { /// /// Filters the history tables to only return ones related to the parent table diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SystemDataTypeChildFactories.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SystemDataTypeChildFactories.cs similarity index 98% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SystemDataTypeChildFactories.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SystemDataTypeChildFactories.cs index f2076d15..d8b411c9 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SystemDataTypeChildFactories.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SystemDataTypeChildFactories.cs @@ -3,13 +3,11 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System.Collections.Generic; using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel { internal partial class SystemExactNumericsChildFactory { diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SqlServerType.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SqlServerType.cs similarity index 96% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SqlServerType.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SqlServerType.cs index a1b2a457..d96b7041 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SqlServerType.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SqlServerType.cs @@ -3,15 +3,12 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System; using Microsoft.SqlServer.Management.Common; using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.Connection.Contracts; using Microsoft.SqlTools.Utility; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer { /// /// Server Types @@ -102,7 +99,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer /// /// Creates a server type from the server version /// - public static SqlServerType CalculateServerType(ServerInfo serverInfo) + public static SqlServerType CalculateServerType(ObjectExplorerServerInfo serverInfo) { string serverVersion = serverInfo.ServerVersion; diff --git a/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/StatelessObjectExplorer.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/StatelessObjectExplorer.cs new file mode 100644 index 00000000..95e36f94 --- /dev/null +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/StatelessObjectExplorer.cs @@ -0,0 +1,119 @@ +// +// 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 System.Linq; +using System.Threading; +using System.Threading.Tasks; + +using Microsoft.Data.SqlClient; +using Microsoft.SqlServer.Management.Common; +using Microsoft.SqlTools.SqlCore.Connection; +using Microsoft.SqlTools.SqlCore.ObjectExplorer; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel; + +namespace Microsoft.SqlTools.CoreSql.ObjectExplorer +{ + /// + /// Stateless object explorer class can be used to handle object explorer requests without creating a session. It requires a connection string and a node path to query objects from the server. + /// + public class StatelessObjectExplorer + { + /// + /// Expands the node at the given path and returns the child nodes. + /// + /// Connection string to connect to the server + /// Access token to connect to the server. To be used in case of AAD based connections + /// Path of the node to expand + /// Server information + /// Object explorer options + /// Filters to be applied on the leaf nodes + /// Array of child nodes + /// Thrown when the parent node is not found + /// Thrown when the operation times out. + /// + public static TreeNode[] Expand(string connectionString, SecurityToken? accessToken, string nodePath, ObjectExplorerServerInfo serverInfo, ObjectExplorerOptions options, INodeFilter[]? filters = null) + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + ServerConnection connection; + if (accessToken != null) + { + connection = new ServerConnection(conn, accessToken as IRenewableToken); + } + else + { + connection = new ServerConnection(conn); + } + + ServerNode serverNode = new ServerNode(serverInfo, connection, null, options.GroupBySchemaFlagGetter); + + TreeNode rootNode = new DatabaseTreeNode(serverNode, serverInfo.DatabaseName); + + if(nodePath == null || nodePath == string.Empty) + { + nodePath = rootNode.GetNodePath(); + } + + using (var taskCancellationTokenSource = new CancellationTokenSource()) + { + TreeNode? node = rootNode; + if (node == null) + { + // Return empty array if node is not found + return new TreeNode[0]; + } + + if (Monitor.TryEnter(node.BuildingMetadataLock, options.OperationTimeoutSeconds)) + { + try + { + var token = accessToken == null ? null : accessToken.Token; + + var task = Task.Run(() => + { + var node = rootNode.FindNodeByPath(nodePath, true, taskCancellationTokenSource.Token); + if (node != null) + { + return node.Expand(taskCancellationTokenSource.Token, token, filters); + } else + { + throw new InvalidArgumentException($"Parent node not found for path {nodePath}"); + } + }); + + if (task.Wait(TimeSpan.FromSeconds(options.OperationTimeoutSeconds))) + { + if (taskCancellationTokenSource.IsCancellationRequested) + { + throw new TimeoutException("The operation has timed out."); + } + return task.Result.ToArray(); + } + else + { + throw new TimeoutException("The operation has timed out."); + } + } + finally + { + if (connection.IsOpen) + { + connection.Disconnect(); + } + Monitor.Exit(node.BuildingMetadataLock); + } + } + else + { + throw new TimeoutException("The operation has timed out. Could not acquire the lock to build metadata for the node."); + } + } + } + } + + + } +} \ No newline at end of file diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ValidForFlag.cs b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/ValidForFlag.cs similarity index 94% rename from src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ValidForFlag.cs rename to src/Microsoft.SqlTools.SqlCore/ObjectExplorer/ValidForFlag.cs index a24e9b94..0c2acb6d 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ValidForFlag.cs +++ b/src/Microsoft.SqlTools.SqlCore/ObjectExplorer/ValidForFlag.cs @@ -3,11 +3,9 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - using System; -namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer +namespace Microsoft.SqlTools.SqlCore.ObjectExplorer { /// /// Indicates which type of server a given node type is valid for diff --git a/src/Microsoft.SqlTools.ServiceLayer/Utility/CommonConstants.cs b/src/Microsoft.SqlTools.SqlCore/Utility/CommonConstants.cs similarity index 94% rename from src/Microsoft.SqlTools.ServiceLayer/Utility/CommonConstants.cs rename to src/Microsoft.SqlTools.SqlCore/Utility/CommonConstants.cs index 630c3686..d00a0334 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Utility/CommonConstants.cs +++ b/src/Microsoft.SqlTools.SqlCore/Utility/CommonConstants.cs @@ -3,10 +3,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#nullable disable - - -namespace Microsoft.SqlTools.ServiceLayer.Utility +namespace Microsoft.SqlTools.SqlCore.Utility { /// /// Common Constant values used across multiple services diff --git a/src/Microsoft.SqlTools.SqlCore/Utility/DatabaseUtils.cs b/src/Microsoft.SqlTools.SqlCore/Utility/DatabaseUtils.cs new file mode 100644 index 00000000..86c77900 --- /dev/null +++ b/src/Microsoft.SqlTools.SqlCore/Utility/DatabaseUtils.cs @@ -0,0 +1,27 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; + + +namespace Microsoft.SqlTools.SqlCore.Utility +{ + public static class DatabaseUtils + { + /// + /// Check if the database is a system database + /// + /// the name of database + /// return true if the database is a system database + public static bool IsSystemDatabaseConnection(string databaseName) + { + return (string.IsNullOrWhiteSpace(databaseName) || + string.Compare(databaseName, CommonConstants.MasterDatabaseName, StringComparison.OrdinalIgnoreCase) == 0 || + string.Compare(databaseName, CommonConstants.MsdbDatabaseName, StringComparison.OrdinalIgnoreCase) == 0 || + string.Compare(databaseName, CommonConstants.ModelDatabaseName, StringComparison.OrdinalIgnoreCase) == 0 || + string.Compare(databaseName, CommonConstants.TempDbDatabaseName, StringComparison.OrdinalIgnoreCase) == 0); + } + } +} diff --git a/src/Microsoft.SqlTools.SqlCore/Utility/Utils.cs b/src/Microsoft.SqlTools.SqlCore/Utility/Utils.cs new file mode 100644 index 00000000..e7a5dcb5 --- /dev/null +++ b/src/Microsoft.SqlTools.SqlCore/Utility/Utils.cs @@ -0,0 +1,109 @@ +// +// 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 System.Text; + +namespace Microsoft.SqlTools.SqlCore.Utility +{ + public class StringUtils + { + /// + /// Function doubles up specified character in a string + /// + /// + /// + /// + public static String EscapeString(string s, char cEsc) + { + if (string.IsNullOrWhiteSpace(s)) + { + return s; + } + + StringBuilder sb = new StringBuilder(s.Length * 2); + foreach (char c in s) + { + sb.Append(c); + if (cEsc == c) + sb.Append(c); + } + return sb.ToString(); + } + + /// + /// Function doubles up ']' character in a string + /// + /// + /// + public static String EscapeStringCBracket(string s) + { + return EscapeString(s, ']'); + } + + /// + /// Function doubles up '\'' character in a string + /// + /// + /// + public static String EscapeStringSQuote(string s) + { + return EscapeString(s, '\''); + } + + /// + /// Function removes doubled up specified character from a string + /// + /// + /// + /// + public static String UnEscapeString(string s, char cEsc) + { + StringBuilder sb = new StringBuilder(s.Length); + bool foundBefore = false; + foreach (char c in s) + { + if (cEsc == c) // character to unescape + { + if (foundBefore) // skip second occurrence + { + foundBefore = false; + } + else // set the flag to skip next time around + { + sb.Append(c); + foundBefore = true; + } + } + else + { + sb.Append(c); + foundBefore = false; + } + } + return sb.ToString(); + } + + /// + /// Function removes doubled up ']' character from a string + /// + /// + /// + public static String UnEscapeStringCBracket(string s) + { + return UnEscapeString(s, ']'); + } + + /// + /// Function removes doubled up '\'' character from a string + /// + /// + /// + public static String UnEscapeStringSQuote(string s) + { + return UnEscapeString(s, '\''); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Metadata/MetadataServiceTests.cs b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Metadata/MetadataServiceTests.cs index 20996c74..a94afaef 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Metadata/MetadataServiceTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Metadata/MetadataServiceTests.cs @@ -21,6 +21,7 @@ using System.Threading; using System.Threading.Tasks; using NUnit.Framework; using static Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility.LiveConnectionHelper; +using Microsoft.SqlTools.SqlCore.Metadata; namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Metadata { diff --git a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/ObjectExplorer/ObjectExplorerServiceTests.cs b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/ObjectExplorer/ObjectExplorerServiceTests.cs index fa1c78ad..23b4dad5 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/ObjectExplorer/ObjectExplorerServiceTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/ObjectExplorer/ObjectExplorerServiceTests.cs @@ -18,7 +18,7 @@ using System.Threading.Tasks; using Microsoft.SqlTools.ServiceLayer.Connection.Contracts; using Microsoft.SqlTools.ServiceLayer.ObjectExplorer; using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; using Microsoft.SqlTools.ServiceLayer.SqlContext; using Microsoft.SqlTools.ServiceLayer.Test.Common; using Microsoft.SqlTools.ServiceLayer.Test.Common.Extensions; @@ -70,9 +70,9 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer await RunTest(databaseName, query, "TepmDb", async (testDbName, session) => { var serverChildren = (await _service.ExpandNode(session, session.Root.GetNodePath())).Nodes; - var securityNode = serverChildren.FirstOrDefault(x => x.Label == SR.SchemaHierarchy_Security); + var securityNode = serverChildren.FirstOrDefault(x => x.Label == SqlTools.SqlCore.SR.SchemaHierarchy_Security); var securityChildren = (await _service.ExpandNode(session, securityNode.NodePath)).Nodes; - var loginsNode = securityChildren.FirstOrDefault(x => x.Label == SR.SchemaHierarchy_Logins); + var loginsNode = securityChildren.FirstOrDefault(x => x.Label == SqlTools.SqlCore.SR.SchemaHierarchy_Logins); var loginsChildren = (await _service.ExpandNode(session, loginsNode.NodePath)).Nodes; var login = loginsChildren.FirstOrDefault(x => x.Label == "OEServerLogin"); Assert.NotNull(login); @@ -106,9 +106,9 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer await RunTest(databaseName, query, "TepmDb", async (testDbName, session) => { var serverChildren = (await _service.ExpandNode(session, session.Root.GetNodePath())).Nodes; - var serverObjectsNode = serverChildren.FirstOrDefault(x => x.Label == SR.SchemaHierarchy_ServerObjects); + var serverObjectsNode = serverChildren.FirstOrDefault(x => x.Label == SqlTools.SqlCore.SR.SchemaHierarchy_ServerObjects); var serverObjectsChildren = (await _service.ExpandNode(session, serverObjectsNode.NodePath)).Nodes; - var triggersNode = serverObjectsChildren.FirstOrDefault(x => x.Label == SR.SchemaHierarchy_Triggers); + var triggersNode = serverObjectsChildren.FirstOrDefault(x => x.Label == SqlTools.SqlCore.SR.SchemaHierarchy_Triggers); var triggersChildren = await _service.ExpandNode(session, triggersNode.NodePath); var trigger = triggersChildren.Nodes.FirstOrDefault(x => x.Label == "OE_ddl_trig_database"); Assert.NotNull(trigger); @@ -134,7 +134,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer string databaseName = "#testDb#"; await RunTest(databaseName, query, "TestDb", async (testDbName, session) => { - var tablesNode = await FindNodeByLabel(session.Root.ToNodeInfo(), session, SR.SchemaHierarchy_Tables); + var tablesNode = await FindNodeByLabel(new NodeInfo(session.Root), session, SqlTools.SqlCore.SR.SchemaHierarchy_Tables); var tableChildren = (await _service.ExpandNode(session, tablesNode.NodePath)).Nodes; string dropTableScript = "Drop Table t1"; Assert.True(tableChildren.Any(t => t.Label == "dbo.t1")); @@ -161,7 +161,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer { var databaseNode = await ExpandServerNodeAndVerifyDatabaseHierachy(testDbName, session); var response = await _service.ExpandNode(session, databaseNode.NodePath); - Assert.True(response.ErrorMessage.Contains(string.Format(CultureInfo.InvariantCulture, SR.DatabaseNotAccessible, testDbName))); + Assert.True(response.ErrorMessage.Contains(string.Format(CultureInfo.InvariantCulture, SqlTools.SqlCore.SR.DatabaseNotAccessible, testDbName))); }); } @@ -178,7 +178,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer string databaseName = "#testDb#"; await RunTest(databaseName, query, "TestDb", async (testDbName, session) => { - var tablesNode = await FindNodeByLabel(session.Root.ToNodeInfo(), session, SR.SchemaHierarchy_Tables); + var tablesNode = await FindNodeByLabel(new NodeInfo(session.Root), session, SqlTools.SqlCore.SR.SchemaHierarchy_Tables); //Expand Tables node var tableChildren = await _service.ExpandNode(session, tablesNode.NodePath); @@ -198,7 +198,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer //Verify the tables cache has items var rootChildrenCache = session.Root.GetChildren(); - var tablesCache = rootChildrenCache.First(x => x.Label == SR.SchemaHierarchy_Tables).GetChildren(); + var tablesCache = rootChildrenCache.First(x => x.Label == SqlTools.SqlCore.SR.SchemaHierarchy_Tables).GetChildren(); Assert.True(tablesCache.Any()); await VerifyRefresh(session, tablesNode.NodePath, "dbo.t1"); @@ -220,10 +220,10 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer await RunTest(databaseName, query, "TestDb", async (testDbName, session) => { WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer = new ObjectExplorerSettings() { GroupBySchema = false }; - var databaseNode = session.Root.ToNodeInfo(); + var databaseNode = new NodeInfo(session.Root); var databaseChildren = await _service.ExpandNode(session, databaseNode.NodePath); - Assert.True(databaseChildren.Nodes.Any(t => t.Label == SR.SchemaHierarchy_Tables), "Tables node should be found in database node when group by schema is disabled"); - Assert.True(databaseChildren.Nodes.Any(t => t.Label == SR.SchemaHierarchy_Views), "Views node should be found in database node when group by schema is disabled"); + Assert.True(databaseChildren.Nodes.Any(t => t.Label == SqlTools.SqlCore.SR.SchemaHierarchy_Tables), "Tables node should be found in database node when group by schema is disabled"); + Assert.True(databaseChildren.Nodes.Any(t => t.Label == SqlTools.SqlCore.SR.SchemaHierarchy_Views), "Views node should be found in database node when group by schema is disabled"); }); } @@ -238,13 +238,13 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer await RunTest(databaseName, query, "TestDb", async (testDbName, session) => { WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer = new ObjectExplorerSettings() { GroupBySchema = true }; - var databaseNode = session.Root.ToNodeInfo(); + var databaseNode = new NodeInfo(session.Root); var databaseChildren = await _service.ExpandNode(session, databaseNode.NodePath); Assert.True(databaseChildren.Nodes.Any(t => t.Label == "t1"), "Schema node t1 should be found in database node when group by schema is enabled"); Assert.True(databaseChildren.Nodes.Any(t => t.Label == "t2"), "Schema node t2 should be found in database node when group by schema is enabled"); - Assert.False(databaseChildren.Nodes.Any(t => t.Label == SR.SchemaHierarchy_Tables), "Tables node should not be found in database node when group by schema is enabled"); - Assert.False(databaseChildren.Nodes.Any(t => t.Label == SR.SchemaHierarchy_Views), "Views node should not be found in database node when group by schema is enabled"); - Assert.True(databaseChildren.Nodes.Any(t => t.Label == SR.SchemaHierarchy_Programmability), "Programmability node should be found in database node when group by schema is enabled"); + Assert.False(databaseChildren.Nodes.Any(t => t.Label == SqlTools.SqlCore.SR.SchemaHierarchy_Tables), "Tables node should not be found in database node when group by schema is enabled"); + Assert.False(databaseChildren.Nodes.Any(t => t.Label == SqlTools.SqlCore.SR.SchemaHierarchy_Views), "Views node should not be found in database node when group by schema is enabled"); + Assert.True(databaseChildren.Nodes.Any(t => t.Label == SqlTools.SqlCore.SR.SchemaHierarchy_Programmability), "Programmability node should be found in database node when group by schema is enabled"); var lastSchemaPosition = Array.FindLastIndex(databaseChildren.Nodes, t => t.ObjectType == nameof(NodeTypes.ExpandableSchema)); var firstNonSchemaPosition = Array.FindIndex(databaseChildren.Nodes, t => t.ObjectType != nameof(NodeTypes.ExpandableSchema)); Assert.True(lastSchemaPosition < firstNonSchemaPosition, "Schema nodes should be before non-schema nodes"); @@ -263,7 +263,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer await RunTest(databaseName, query, "TestDb", async (testDbName, session) => { WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer = new ObjectExplorerSettings() { GroupBySchema = true }; - var databaseNode = session.Root.ToNodeInfo(); + var databaseNode = new NodeInfo(session.Root); var databaseChildren = await _service.ExpandNode(session, databaseNode.NodePath); Assert.True(databaseChildren.Nodes.Any(t => t.Label == "t1"), "Non legacy schema node t1 should be found in database node when group by schema is enabled"); Assert.True(databaseChildren.Nodes.Any(t => t.Label == "t2"), "Non legacy schema node t2 should be found in database node when group by schema is enabled"); @@ -283,7 +283,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer { Assert.That(legacySchemas, Does.Not.Contain(nodes.Label), "Legacy schema node should not be found in database node when group by schema is enabled"); } - var legacySchemasNode = databaseChildren.Nodes.First(t => t.Label == SR.SchemaHierarchy_BuiltInSchema); + var legacySchemasNode = databaseChildren.Nodes.First(t => t.Label == SqlTools.SqlCore.SR.SchemaHierarchy_BuiltInSchema); var legacySchemasChildren = await _service.ExpandNode(session, legacySchemasNode.NodePath); foreach (var nodes in legacySchemasChildren.Nodes) { @@ -306,10 +306,10 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer string databaseName = "#testDb#"; await RunTest(databaseName, query, "Testdb", async (testDbName, session) => { - var databaseNode = session.Root.ToNodeInfo(); + var databaseNode = new NodeInfo(session.Root); var databaseChildren = await _service.ExpandNode(session, databaseNode.NodePath); - Assert.True(databaseChildren.Nodes.Any(t => t.Label == SR.SchemaHierarchy_Tables), "Tables node should be found in database node"); - var tablesNode = databaseChildren.Nodes.First(t => t.Label == SR.SchemaHierarchy_Tables); + Assert.True(databaseChildren.Nodes.Any(t => t.Label == SqlTools.SqlCore.SR.SchemaHierarchy_Tables), "Tables node should be found in database node"); + var tablesNode = databaseChildren.Nodes.First(t => t.Label == SqlTools.SqlCore.SR.SchemaHierarchy_Tables); var NameProperty = tablesNode.FilterableProperties.First(t => t.Name == "Name"); Assert.True(NameProperty != null, "Name property should be found in tables node"); @@ -385,11 +385,11 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer private async Task VerifyRefresh(ObjectExplorerSession session, string tablePath, string tableName, bool deleted = true) { //Refresh Root - var rootChildren = await _service.ExpandNode(session, session.Root.ToNodeInfo().NodePath, true); + var rootChildren = await _service.ExpandNode(session, new NodeInfo(session.Root).NodePath, true); //Verify tables cache is empty var rootChildrenCache = session.Root.GetChildren(); - var tablesCache = rootChildrenCache.First(x => x.Label == SR.SchemaHierarchy_Tables).GetChildren(); + var tablesCache = rootChildrenCache.First(x => x.Label == SqlTools.SqlCore.SR.SchemaHierarchy_Tables).GetChildren(); Assert.False(tablesCache.Any()); //Expand Tables @@ -400,7 +400,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer //Verify tables cache has items rootChildrenCache = session.Root.GetChildren(); - tablesCache = rootChildrenCache.First(x => x.Label == SR.SchemaHierarchy_Tables).GetChildren(); + tablesCache = rootChildrenCache.First(x => x.Label == SqlTools.SqlCore.SR.SchemaHierarchy_Tables).GetChildren(); Assert.True(tablesCache.Any()); } @@ -473,7 +473,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer { Assert.That(session, Is.Not.Null, nameof(session)); Assert.That(session.Root, Is.Not.Null, nameof(session.Root)); - var nodeInfo = session.Root.ToNodeInfo(); + var nodeInfo = new NodeInfo(session.Root); Assert.That(nodeInfo.IsLeaf, Is.False, "Should not be a leaf node"); NodeInfo databaseNode = null; @@ -496,8 +496,8 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer // Verify the test databases is in the list Assert.False(databases.Any(x => x.Label == "master")); Assert.That(databases, Has.None.Matches(n => n.Label == "master"), "master database not expected in user databases folder"); - var systemDatabasesNodes = databasesChildren.Where(x => x.Label == SR.SchemaHierarchy_SystemDatabases).ToList(); - Assert.That(systemDatabasesNodes, Has.Count.EqualTo(1), $"Exactly one {SR.SchemaHierarchy_SystemDatabases} node expected"); + var systemDatabasesNodes = databasesChildren.Where(x => x.Label == SqlTools.SqlCore.SR.SchemaHierarchy_SystemDatabases).ToList(); + Assert.That(systemDatabasesNodes, Has.Count.EqualTo(1), $"Exactly one {SqlTools.SqlCore.SR.SchemaHierarchy_SystemDatabases} node expected"); var expandResponse = await _service.ExpandNode(session, systemDatabasesNodes.First().NodePath); Assert.That(expandResponse.Nodes, Has.One.Matches(n => n.Label == "master"), "master database expected in system databases folder"); @@ -507,10 +507,10 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer else { Assert.That(nodeInfo.NodeType, Is.EqualTo(NodeTypes.Database.ToString()), $"Database node {nodeInfo.Label} has incorrect type"); - databaseNode = session.Root.ToNodeInfo(); + databaseNode = new NodeInfo(session.Root); Assert.True(databaseNode.Label.Contains(databaseName)); var databasesChildren = (await _service.ExpandNode(session, databaseNode.NodePath)).Nodes; - Assert.False(databasesChildren.Any(x => x.Label == SR.SchemaHierarchy_SystemDatabases)); + Assert.False(databasesChildren.Any(x => x.Label == SqlTools.SqlCore.SR.SchemaHierarchy_SystemDatabases)); } Assert.That(databaseNode, Is.Not.Null, "Database node should not be null"); @@ -521,7 +521,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer { Assert.NotNull(session); Assert.NotNull(session.Root); - var nodeInfo = session.Root.ToNodeInfo(); + var nodeInfo = new NodeInfo(session.Root); Assert.AreEqual(false, nodeInfo.IsLeaf); Assert.AreEqual(nodeInfo.NodeType, NodeTypes.Database.ToString()); Assert.True(nodeInfo.Label.Contains(databaseName)); @@ -533,7 +533,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer Assert.AreEqual("Folder", item.NodeType); } - var tablesRoot = children.FirstOrDefault(x => x.Label == SR.SchemaHierarchy_Tables); + var tablesRoot = children.FirstOrDefault(x => x.Label == SqlTools.SqlCore.SR.SchemaHierarchy_Tables); Assert.NotNull(tablesRoot); } @@ -555,10 +555,10 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer { stringBuilder.Append($"NodeType: {child.NodeType} Label: {child.Label} SubType:{child.NodeSubType} Status:{child.NodeStatus}{Environment.NewLine}"); } - if (!verifySystemObjects && (child.Label == SR.SchemaHierarchy_SystemStoredProcedures || - child.Label == SR.SchemaHierarchy_SystemViews || - child.Label == SR.SchemaHierarchy_SystemFunctions || - child.Label == SR.SchemaHierarchy_SystemDataTypes)) + if (!verifySystemObjects && (child.Label == SqlTools.SqlCore.SR.SchemaHierarchy_SystemStoredProcedures || + child.Label == SqlTools.SqlCore.SR.SchemaHierarchy_SystemViews || + child.Label == SqlTools.SqlCore.SR.SchemaHierarchy_SystemFunctions || + child.Label == SqlTools.SqlCore.SR.SchemaHierarchy_SystemDataTypes)) { // don't expand the system folders because then the test will take for ever } @@ -642,7 +642,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer await RunTest(databaseName, query, testDbPrefix, async (testDbName, session) => { await ExpandServerNodeAndVerifyDatabaseHierachy(testDbName, session, false); - await ExpandTree(session.Root.ToNodeInfo(), session, stringBuilder, verifySystemObjects); + await ExpandTree(new NodeInfo(session.Root), session, stringBuilder, verifySystemObjects); string baseline = string.IsNullOrEmpty(baselineFileName) ? string.Empty : LoadBaseLine(baselineFileName); if (!string.IsNullOrEmpty(baseline)) { diff --git a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/ObjectExplorer/StatelessObjectExplorerServiceTests.cs b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/ObjectExplorer/StatelessObjectExplorerServiceTests.cs new file mode 100644 index 00000000..342869de --- /dev/null +++ b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/ObjectExplorer/StatelessObjectExplorerServiceTests.cs @@ -0,0 +1,84 @@ +// +// 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 System.Threading.Tasks; +using NUnit.Framework; +using Microsoft.SqlTools.ServiceLayer.Test.Common; +using Microsoft.SqlTools.CoreSql.ObjectExplorer; +using Microsoft.SqlTools.ServiceLayer.Test.Common.Extensions; +using Microsoft.SqlTools.SqlCore.ObjectExplorer; +using System.Linq; + +namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer +{ + public class StatelessObjectExplorerServiceTests + { + + string databaseName = "tempdb"; + + ObjectExplorerServerInfo serverInfo = new ObjectExplorerServerInfo() + { + DatabaseName = "tempdb", + ServerName = "testserver", + UserName = "testuser", + IsCloud = true, + isDefaultOrSystemDatabase = false + }; + + ObjectExplorerOptions options = new ObjectExplorerOptions() + { + GroupBySchemaFlagGetter = () => true, + OperationTimeoutSeconds = 10000, + }; + + [Test] + [TestCase("", "dbo")] + [TestCase("testserver/{0}/dbo", "Tables")] + [TestCase("testserver/{0}/dbo/Tables", "dbo.t1")] + [TestCase("testserver/{0}/dbo/Tables", "dbo.t2")] + public async Task ExpandingPathShouldReturnCorrectNodes(string oePath, string childLabel) + { + var query = @"Create table t1 (c1 int) + GO + Create table t2 (c1 int) + GO"; + await RunTest(databaseName, query, "testdb", async (testdbName, connectionString) => + { + serverInfo.DatabaseName = testdbName; + var pathWithDb = string.Format(oePath, testdbName); + var nodes = StatelessObjectExplorer.Expand(connectionString, null, pathWithDb, serverInfo, options); + + Assert.True(nodes.Any(node => node.Label == childLabel), $"Expansion result for {pathWithDb} does not contain node {childLabel}"); + }); + } + + private async Task RunTest(string databaseName, string query, string testDbPrefix, Func test) + { + SqlTestDb? testDb = null; + try + { + testDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, false, null, query, testDbPrefix); + if (databaseName == "#testDb#") + { + databaseName = testDb.DatabaseName; + } + await test(testDb.DatabaseName, testDb.ConnectionString); + } + catch (Exception ex) + { + string msg = ex.BuildRecursiveErrorMessage(); + throw new Exception($"Failed to run OE test. error:{msg} {ex.StackTrace}"); + } + finally + { + if (testDb != null) + { + await testDb.CleanupAsync(); + } + } + } + } +} \ No newline at end of file diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/Microsoft.SqlTools.ServiceLayer.UnitTests.csproj b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/Microsoft.SqlTools.ServiceLayer.UnitTests.csproj index cbfb1bcb..0179e522 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/Microsoft.SqlTools.ServiceLayer.UnitTests.csproj +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/Microsoft.SqlTools.ServiceLayer.UnitTests.csproj @@ -34,6 +34,7 @@ + diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/GroupBySchemaTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/GroupBySchemaTests.cs index a34377e8..223771e3 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/GroupBySchemaTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/GroupBySchemaTests.cs @@ -4,13 +4,17 @@ // using System; using System.Linq; + using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel; +using Microsoft.SqlTools.Extensibility; +using Microsoft.SqlTools.SqlCore.ObjectExplorer; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel; using Microsoft.SqlTools.ServiceLayer.SqlContext; using Microsoft.SqlTools.ServiceLayer.Workspace; + using Moq; + using NUnit.Framework; namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer @@ -19,23 +23,31 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer { Mock factory; Mock node; + Mock context; + bool enableGroupBySchema = false; + [SetUp] public void init() { factory = new Mock(); factory.SetupGet(c => c.ChildQuerierTypes).Returns(null as Type[]); - factory.Setup(c => c.CreateChild(It.IsAny(), It.IsAny())).Returns((TreeNode node, Schema obj) => { - return new TreeNode(){ + factory.Setup(c => c.CreateChild(It.IsAny(), It.IsAny())).Returns((TreeNode node, Schema obj) => + { + return new TreeNode() + { Label = obj.Name, NodeType = nameof(NodeTypes.Schemas) }; }); factory.CallBase = true; - Mock context = new Mock(new Server(), null); + context = new Mock(new Server(), ExtensionServiceProvider.CreateDefaultServiceProvider(), () => + { + return enableGroupBySchema; + }); context.CallBase = true; context.Object.ValidFor = ValidForFlag.None; - + node = new Mock(); node.Setup(n => n.GetContext()).Returns(context.Object); } @@ -43,7 +55,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer [Test] public void SchemaBasedFoldersExcludedWhenGroupBySchemaIsEnabled() { - WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer = new ObjectExplorerSettings() { GroupBySchema = true }; + enableGroupBySchema = true; var children = factory.Object.Expand(node.Object, true, "TestDB", true, new System.Threading.CancellationToken()); Assert.False(children.Any(c => c.Label == "Tables"), "Tables subfolder in database should be excluded when group by schema is enabled"); Assert.False(children.Any(c => c.Label == "Views"), "Views subfolder in database should be excluded when group by schema is enabled"); @@ -53,6 +65,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer [Test] public void SchemaBasedFoldersIncludedWhenGroupBySchemaIsDisabled() { + enableGroupBySchema = false; WorkspaceService.Instance.CurrentSettings.SqlTools.ObjectExplorer = new ObjectExplorerSettings() { GroupBySchema = false }; var children = factory.Object.Expand(node.Object, true, "TestDB", true, new System.Threading.CancellationToken()); Assert.True(children.Any(c => c.Label == "Tables"), "Tables subfolder in database should be included when group by schema is disabled"); @@ -60,7 +73,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer Assert.True(children.Any(c => c.Label == "Synonyms"), "Synonyms subfolder in database should be included when group by schema is disabled"); } - + } } \ No newline at end of file diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/NodeFilterTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/NodeFilterTests.cs index fbfd775c..621062d8 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/NodeFilterTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/NodeFilterTests.cs @@ -9,9 +9,9 @@ using System; using System.Collections.Generic; using Newtonsoft.Json; using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel; +using Microsoft.SqlTools.SqlCore.ObjectExplorer; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel; using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts; using NUnit.Framework; using Newtonsoft.Json.Linq; @@ -908,7 +908,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer [TestCaseSource("ConvertExpandNodeFilterToNodeFilterTestCases")] public void TestConvertExpandNodeFilterToNodeFilter(NodeFilter filter, NodeFilterProperty prop, INodeFilter expectedParsedFilter) { - INodeFilter actualParsedFilter = ObjectExplorerUtils.ConvertExpandNodeFilterToNodeFilter(filter, prop); + INodeFilter actualParsedFilter = filter.ToINodeFilter(prop); Assert.That( JsonConvert.SerializeObject(actualParsedFilter), Is.EqualTo(JsonConvert.SerializeObject(expectedParsedFilter)), diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/NodePathGeneratorTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/NodePathGeneratorTests.cs index 960bd5de..95aa4834 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/NodePathGeneratorTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/NodePathGeneratorTests.cs @@ -7,8 +7,8 @@ using System.Collections.Generic; using Microsoft.SqlTools.ServiceLayer.ObjectExplorer; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel; using NUnit.Framework; namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer @@ -29,7 +29,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer NodeValue = serverName }; - serverSession = new ObjectExplorerService.ObjectExplorerSession("serverUri", serverRoot, null, null); + serverSession = new ObjectExplorerService.ObjectExplorerSession("serverUri", serverRoot); var databaseRoot = new TreeNode { @@ -38,7 +38,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer Parent = serverRoot }; - databaseSession = new ObjectExplorerService.ObjectExplorerSession("databaseUri", databaseRoot, null, null); + databaseSession = new ObjectExplorerService.ObjectExplorerSession("databaseUri", databaseRoot); } [Test] diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/NodeTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/NodeTests.cs index 6411f4f0..f7838dc9 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/NodeTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/NodeTests.cs @@ -4,24 +4,28 @@ // #nullable disable - using System; using System.Collections.Generic; -using Microsoft.Data.SqlClient; using System.Globalization; +using System.IO; using System.Threading; + +using Microsoft.Data.SqlClient; using Microsoft.SqlServer.Management.Common; using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlTools.Extensibility; +using Microsoft.SqlTools.ServiceLayer.Connection; using Microsoft.SqlTools.ServiceLayer.Connection.Contracts; using Microsoft.SqlTools.ServiceLayer.ObjectExplorer; using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel; using Microsoft.SqlTools.ServiceLayer.UnitTests.Utility; +using Microsoft.SqlTools.SqlCore.ObjectExplorer; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel; + using Moq; + using NUnit.Framework; -using Microsoft.SqlTools.ServiceLayer.Connection; namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer { @@ -31,16 +35,17 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer public class NodeTests : ObjectExplorerTestBase { private string defaultOwnerUri = "objectexplorer://myserver"; - private ServerInfo defaultServerInfo; + private ObjectExplorerServerInfo oeServerInfo = null; private ConnectionDetails defaultConnectionDetails; private ConnectionCompleteParams defaultConnParams; private string fakeConnectionString = "Data Source=server;Initial Catalog=database;Integrated Security=False;User Id=user"; private ServerConnection serverConnection = null; + [SetUp] public void InitNodeTests() { - defaultServerInfo = TestObjects.GetTestServerInfo(); + var defaultServerInfo = TestObjects.GetTestServerInfo(); serverConnection = new ServerConnection(new SqlConnection(fakeConnectionString)); defaultConnectionDetails = new ConnectionDetails() @@ -53,31 +58,41 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer defaultConnParams = new ConnectionCompleteParams() { ServerInfo = defaultServerInfo, - ConnectionSummary = defaultConnectionDetails != null ? ((IConnectionSummary)defaultConnectionDetails).Clone(): null, + ConnectionSummary = defaultConnectionDetails != null ? ((IConnectionSummary)defaultConnectionDetails).Clone() : null, OwnerUri = defaultOwnerUri }; + oeServerInfo = new ObjectExplorerServerInfo() + { + ServerName = defaultConnectionDetails.ServerName, + DatabaseName = defaultConnectionDetails.DatabaseName, + UserName = defaultConnectionDetails.UserName, + ServerVersion = defaultServerInfo.ServerVersion, + EngineEditionId = defaultServerInfo.EngineEditionId, + IsCloud = defaultServerInfo.IsCloud + }; + + var smoquery = typeof(SqlCore.ObjectExplorer.SmoModel.SmoQuerier).Assembly; // TODO can all tests use the standard service provider? - ServiceProvider = ExtensionServiceProvider.CreateDefaultServiceProvider(); + ServiceProvider = ExtensionServiceProvider.CreateFromAssembliesInDirectory(Path.GetDirectoryName(smoquery.Location),new string[] { Path.GetFileName(smoquery.Location) }); } - + [Test] public void ServerNodeConstructorValidatesFields() { - Assert.Throws(() => new ServerNode(null, ServiceProvider, serverConnection)); - Assert.Throws(() => new ServerNode(defaultConnParams, null, serverConnection)); + Assert.Throws(() => new ServerNode(null, serverConnection, ServiceProvider)); } [Test] public void ServerNodeConstructorShouldSetValuesCorrectly() { // Given a server node with valid inputs - ServerNode node = new ServerNode(defaultConnParams, ServiceProvider, serverConnection); + ServerNode node = new ServerNode(oeServerInfo, serverConnection, ServiceProvider); // Then expect all fields set correctly Assert.False(node.IsAlwaysLeaf, "Server node should never be a leaf"); Assert.AreEqual(defaultConnectionDetails.ServerName, node.NodeValue); - string expectedLabel = defaultConnectionDetails.ServerName + " (SQL Server " + defaultServerInfo.ServerVersion + " - " + string expectedLabel = defaultConnectionDetails.ServerName + " (SQL Server " + oeServerInfo.ServerVersion + " - " + defaultConnectionDetails.UserName + ")"; Assert.AreEqual(expectedLabel, node.Label); @@ -91,55 +106,43 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer public void ServerNodeLabelShouldIgnoreUserNameIfEmptyOrNull() { // Given no username set - ConnectionSummary integratedAuthSummary = new ConnectionSummary() - { - DatabaseName = defaultConnectionDetails.DatabaseName, - ServerName = defaultConnectionDetails.ServerName, - UserName = null - }; - ConnectionCompleteParams connParams = new ConnectionCompleteParams() - { - ConnectionSummary = integratedAuthSummary, - ServerInfo = defaultServerInfo, - OwnerUri = defaultOwnerUri - }; + oeServerInfo.UserName = null; // When querying label - string label = new ServerNode(connParams, ServiceProvider, serverConnection).Label; + string label = new ServerNode(oeServerInfo, serverConnection, ServiceProvider).Label; // Then only server name and version shown - string expectedLabel = defaultConnectionDetails.ServerName + " (SQL Server " + defaultServerInfo.ServerVersion + ")"; + string expectedLabel = oeServerInfo.ServerName + " (SQL Server " + oeServerInfo.ServerVersion + ")"; Assert.AreEqual(expectedLabel, label); } [Test] public void ServerNodeConstructorShouldShowDbNameForCloud() { - defaultServerInfo.IsCloud = true; + oeServerInfo.IsCloud = true; // Given a server node for a cloud DB, with master name - ServerNode node = new ServerNode(defaultConnParams, ServiceProvider, serverConnection); + ServerNode node = new ServerNode(oeServerInfo, serverConnection); // Then expect label to not include db name - string expectedLabel = defaultConnectionDetails.ServerName + " (SQL Server " + defaultServerInfo.ServerVersion + " - " - + defaultConnectionDetails.UserName + ")"; + string expectedLabel = oeServerInfo.ServerName + " (SQL Server " + oeServerInfo.ServerVersion + " - " + + oeServerInfo.UserName + ")"; Assert.AreEqual(expectedLabel, node.Label); // But given a server node for a cloud DB that's not master - defaultConnectionDetails.DatabaseName = "NotMaster"; - defaultConnParams.ConnectionSummary.DatabaseName = defaultConnectionDetails.DatabaseName; - node = new ServerNode(defaultConnParams, ServiceProvider, serverConnection); + oeServerInfo.DatabaseName = "NotMaster"; + node = new ServerNode(oeServerInfo, serverConnection, ServiceProvider); // Then expect label to include db name - expectedLabel = defaultConnectionDetails.ServerName + " (SQL Server " + defaultServerInfo.ServerVersion + " - " - + defaultConnectionDetails.UserName + ", " + defaultConnectionDetails.DatabaseName + ")"; + expectedLabel = oeServerInfo.ServerName + " (SQL Server " + oeServerInfo.ServerVersion + " - " + + oeServerInfo.UserName + ", " + oeServerInfo.DatabaseName + ")"; Assert.AreEqual(expectedLabel, node.Label); } [Test] - public void ToNodeInfoIncludeAllFields() + public void NodeInfoConstructorPopulatesAllFieldsFromTreeNode() { // Given a server connection - ServerNode node = new ServerNode(defaultConnParams, ServiceProvider, serverConnection); + ServerNode node = new ServerNode(oeServerInfo, serverConnection, ServiceProvider); // When converting to NodeInfo - NodeInfo info = node.ToNodeInfo(); + NodeInfo info = new NodeInfo(node); // Then all fields should match Assert.AreEqual(node.IsAlwaysLeaf, info.IsLeaf); Assert.AreEqual(node.Label, info.Label); @@ -192,21 +195,21 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer public void MultiLevelTreeShouldFormatPath() { TreeNode root = new TreeNode("root"); - Assert.AreEqual("root" , root.GetNodePath()); + Assert.AreEqual("root", root.GetNodePath()); TreeNode level1Child1 = new TreeNode("L1C1 (with extra info)"); level1Child1.NodePathName = "L1C1"; TreeNode level1Child2 = new TreeNode("L1C2"); root.AddChild(level1Child1); root.AddChild(level1Child2); - Assert.AreEqual("root/L1C1" , level1Child1.GetNodePath()); + Assert.AreEqual("root/L1C1", level1Child1.GetNodePath()); Assert.AreEqual("root/L1C2", level1Child2.GetNodePath()); TreeNode level2Child1 = new TreeNode("L2C2"); level1Child1.AddChild(level2Child1); Assert.AreEqual("root/L1C1/L2C2", level2Child1.GetNodePath()); } - + [Test] public void ServerNodeContextShouldIncludeServer() { @@ -254,7 +257,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer // Then I expect it to be in an error state Assert.Null(context); Assert.AreEqual( - string.Format(CultureInfo.CurrentCulture, SR.TreeNodeError, expectedMsg), + string.Format(CultureInfo.CurrentCulture, SqlTools.SqlCore.SR.TreeNodeError, expectedMsg), node.ErrorStateMessage); } @@ -272,19 +275,19 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer // Then I expect it to be in an error state Assert.Null(context); Assert.AreEqual( - string.Format(CultureInfo.CurrentCulture, SR.TreeNodeError, expectedMsg), + string.Format(CultureInfo.CurrentCulture, SqlTools.SqlCore.SR.TreeNodeError, expectedMsg), node.ErrorStateMessage); } - + [Test] public void QueryContextShouldNotCallOpenOnAlreadyOpenConnection() { // given a server connection that will state its connection is open Server smoServer = new Server(new ServerConnection(new SqlConnection(fakeConnectionString))); Mock wrapper = SetupSmoWrapperForIsOpenTest(smoServer, isOpen: true); - + SmoQueryContext context = new SmoQueryContext(smoServer, ServiceProvider, wrapper.Object); - + // when I access the Server property Server actualServer = context.Server; @@ -313,9 +316,9 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer // given a server connection that will state its connection is closed Server smoServer = new Server(new ServerConnection(new SqlConnection(fakeConnectionString))); Mock wrapper = SetupSmoWrapperForIsOpenTest(smoServer, isOpen: false); - + SmoQueryContext context = new SmoQueryContext(smoServer, ServiceProvider, wrapper.Object); - + // when I access the Server property Server actualServer = context.Server; @@ -330,7 +333,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer // given a server connection that will state its connection is closed Server smoServer = new Server(new ServerConnection(new SqlConnection(fakeConnectionString))); Mock wrapper = SetupSmoWrapperForIsOpenTest(smoServer, isOpen: false); - + SmoQueryContext context = new SmoQueryContext(smoServer, ServiceProvider, wrapper.Object); context.Parent = smoServer; // when I access the Parent property @@ -378,7 +381,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer private ServerNode SetupServerNodeWithCreator(SmoWrapper creator) { - ServerNode node = new ServerNode(defaultConnParams, ServiceProvider, new ServerConnection(new SqlConnection(fakeConnectionString))); + ServerNode node = new ServerNode(oeServerInfo, new ServerConnection(new SqlConnection(fakeConnectionString)), ServiceProvider, () => false); node.SmoWrapper = creator; return node; } @@ -408,20 +411,20 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer // Then I expect it to contain server-level folders Assert.AreEqual(3, children.Count); - VerifyTreeNode(children[0], "Folder", SR.SchemaHierarchy_Databases); - VerifyTreeNode(children[1], "Folder", SR.SchemaHierarchy_Security); - VerifyTreeNode(children[2], "Folder", SR.SchemaHierarchy_ServerObjects); + VerifyTreeNode(children[0], "Folder", SqlTools.SqlCore.SR.SchemaHierarchy_Databases); + VerifyTreeNode(children[1], "Folder", SqlTools.SqlCore.SR.SchemaHierarchy_Security); + VerifyTreeNode(children[2], "Folder", SqlTools.SqlCore.SR.SchemaHierarchy_ServerObjects); // And the database is contained under it TreeNode databases = children[0]; IList dbChildren = databases.Expand(new CancellationToken()); Assert.AreEqual(2, dbChildren.Count); - Assert.AreEqual(SR.SchemaHierarchy_SystemDatabases, dbChildren[0].NodeValue); + Assert.AreEqual(SqlTools.SqlCore.SR.SchemaHierarchy_SystemDatabases, dbChildren[0].NodeValue); TreeNode dbNode = dbChildren[1]; Assert.AreEqual(dbName, dbNode.NodeValue); Assert.AreEqual(dbName, dbNode.Label); Assert.False(dbNode.IsAlwaysLeaf); - + // Note: would like to verify Database in the context, but cannot since it's a Sealed class and isn't easily mockable } diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/ObjectExplorerServiceTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/ObjectExplorerServiceTests.cs index 0e7e1fa7..138b1687 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/ObjectExplorerServiceTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/ObjectExplorerServiceTests.cs @@ -16,7 +16,7 @@ using Microsoft.SqlTools.ServiceLayer.Connection; using Microsoft.SqlTools.ServiceLayer.Connection.Contracts; using Microsoft.SqlTools.ServiceLayer.ObjectExplorer; using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; using Microsoft.SqlTools.ServiceLayer.UnitTests.Utility; using Moq; using Moq.Protected; @@ -282,7 +282,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer var foundNodes = service.FindNodes(session.SessionId, "Server", null, null, null); Assert.AreEqual(1, foundNodes.Count); Assert.AreEqual("Server", foundNodes[0].NodeType); - Assert.AreEqual(session.RootNode.NodePath, foundNodes[0].ToNodeInfo().NodePath); + Assert.AreEqual(session.RootNode.NodePath, new NodeInfo(foundNodes[0]).NodePath); } [Test] @@ -298,7 +298,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer public void FindNodeCanExpandParentNodes() { var mockTreeNode = new Mock(); - object[] populateChildrenArguments = { ItExpr.Is(x => x == false), ItExpr.IsNull(), new CancellationToken(), ItExpr.IsNull(), ItExpr.IsNull>() }; + object[] populateChildrenArguments = { ItExpr.Is(x => x == false), ItExpr.IsNull(), new CancellationToken(), ItExpr.IsNull(), ItExpr.IsNull>() }; mockTreeNode.Protected().Setup("PopulateChildren", populateChildrenArguments); mockTreeNode.Object.IsAlwaysLeaf = false; diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/ObjectExplorerTestBase.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/ObjectExplorerTestBase.cs index a7d2d431..8d92cc08 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/ObjectExplorerTestBase.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/ObjectExplorerTestBase.cs @@ -8,8 +8,8 @@ using Microsoft.SqlTools.Extensibility; using Microsoft.SqlTools.ServiceLayer.Connection; using Microsoft.SqlTools.ServiceLayer.ObjectExplorer; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel; namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer { diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/ServerVersionHelperTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/ServerVersionHelperTests.cs index f62c9a94..3e3aa54f 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/ServerVersionHelperTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/ServerVersionHelperTests.cs @@ -5,8 +5,7 @@ #nullable disable -using Microsoft.SqlTools.ServiceLayer.Connection.Contracts; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer; +using Microsoft.SqlTools.SqlCore.ObjectExplorer; using NUnit.Framework; namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer @@ -59,7 +58,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer [TestCase("16.1.2.3", SqlServerType.Sql2022)] public void CalculateServerTypeShouldReturnExpectedValue(string serverVersion, SqlServerType expectedServerType) { - ServerInfo serverInfo = new ServerInfo + ObjectExplorerServerInfo serverInfo = new ObjectExplorerServerInfo { ServerVersion = serverVersion }; @@ -128,7 +127,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer private void VerifyCalculateServerTypeForEngineEdition(int engineEdition, SqlServerType expected) { - ServerInfo serverInfo = new ServerInfo + ObjectExplorerServerInfo serverInfo = new ObjectExplorerServerInfo { EngineEditionId = engineEdition }; diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/SmoQueryModelTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/SmoQueryModelTests.cs index 8a1d70d1..571a5702 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/SmoQueryModelTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/SmoQueryModelTests.cs @@ -6,24 +6,32 @@ #nullable disable using System; +using System.IO; using System.Linq; using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlTools.Extensibility; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; +using Microsoft.SqlTools.SqlCore.ObjectExplorer; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes; using NUnit.Framework; namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer { public class SmoQueryModelTests { + IMultiServiceProvider serviceProvider; + + [SetUp] + public void Setup() + { + // Given the extension type loader is set to find SmoCollectionQuerier objects + var assembly = typeof(SmoQuerier).Assembly; + serviceProvider = ExtensionServiceProvider.CreateFromAssembliesInDirectory(Path.GetDirectoryName(assembly.Location), new string[] { Path.GetFileName(assembly.Location) }); + } [Test] public void ShouldFindDatabaseQuerierFromRealPath() { - // Given the extension type loader is set to find SmoCollectionQuerier objects - IMultiServiceProvider serviceProvider = ExtensionServiceProvider.CreateDefaultServiceProvider(); // When I request a database compatible querier SmoQuerier querier = serviceProvider.GetService(q => q.SupportedObjectTypes.Contains(typeof(Database))); // Then I expect to get back the SqlDatabaseQuerier @@ -87,8 +95,6 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer private SmoQuerier GetSmoQuerier(Type querierType) { - // Given the extension type loader is set to find SmoCollectionQuerier objects - IMultiServiceProvider serviceProvider = ExtensionServiceProvider.CreateDefaultServiceProvider(); // When I request a compatible querier SmoQuerier querier = serviceProvider.GetService(q => q.SupportedObjectTypes.Contains(querierType)); // Then I expect to get back the Querier diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/UsersChildFactoryTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/UsersChildFactoryTests.cs index 24cac40f..e2492cbd 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/UsersChildFactoryTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/UsersChildFactoryTests.cs @@ -6,7 +6,7 @@ #nullable disable using Microsoft.SqlServer.Management.Smo; -using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel; +using Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel; using NUnit.Framework; namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer