diff --git a/bin/nuget/Microsoft.SqlServer.Smo.140.17055.0.nupkg b/bin/nuget/Microsoft.SqlServer.Smo.140.17055.0.nupkg new file mode 100644 index 00000000..b5e7c782 Binary files /dev/null and b/bin/nuget/Microsoft.SqlServer.Smo.140.17055.0.nupkg differ diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs index be3c966b..d5e621e6 100755 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs @@ -2333,6 +2333,14 @@ namespace Microsoft.SqlTools.ServiceLayer } } + public static string DatabaseNotAccessible + { + get + { + return Keys.GetString(Keys.DatabaseNotAccessible); + } + } + public static string ScriptingParams_ConnectionString_Property_Invalid { get @@ -4229,6 +4237,9 @@ namespace Microsoft.SqlTools.ServiceLayer public const string SystemVersioned_LabelPart = "SystemVersioned_LabelPart"; + public const string DatabaseNotAccessible = "DatabaseNotAccessible"; + + 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 43a5b0da..6f0f854f 100755 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx @@ -1339,6 +1339,10 @@ System-Versioned + + The database {0} is not accessible. + + Error parsing ScriptingParams.ConnectionString property. diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings index 51743cd3..9c86c0fd 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings @@ -667,6 +667,8 @@ History_LabelPart = History SystemVersioned_LabelPart = System-Versioned +DatabaseNotAccessible = The database {0} is not accessible. + ############################################################################ # Scripting Service diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf index 6836f9ad..7ac33727 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf @@ -2096,6 +2096,11 @@ No Applicable Filegroup + + The database {0} is not accessible. + The database {0} is not accessible. + + \ No newline at end of file diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/ChildFactory.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/ChildFactory.cs index bff8cd9c..0eb6ad4f 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/ChildFactory.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/ChildFactory.cs @@ -37,6 +37,11 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes /// public abstract IEnumerable Filters { get; } + /// + /// The list of properties to be loaded with the object + /// + public abstract IEnumerable SmoProperties { get; } + /// /// Returns the node sub type if the object can have sub types otehr wise returns empty string /// diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeSmoProperty.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeSmoProperty.cs new file mode 100644 index 00000000..5b7f100e --- /dev/null +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/NodeSmoProperty.cs @@ -0,0 +1,23 @@ +// +// 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.ServiceLayer.ObjectExplorer.Nodes +{ + /// + /// Has information for SMO object properties to be loaded with the SMO object + /// + public class NodeSmoProperty + { + /// + /// Property name + /// + public string Name { get; set; } + /// + /// Indicates which platforms a filter is valid for + /// + public ValidForFlag ValidFor { get; set; } + } +} diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNode.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNode.cs index 5c208e40..9144863f 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNode.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNode.cs @@ -286,7 +286,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes return Parent as T; } - protected void PopulateChildren(bool refresh, string name = null) + protected virtual void PopulateChildren(bool refresh, string name = null) { Logger.Write(LogLevel.Verbose, string.Format(CultureInfo.InvariantCulture, "Populating oe node :{0}", this.GetNodePath())); Debug.Assert(IsAlwaysLeaf == false); @@ -331,7 +331,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes } } } - catch(Exception ex) + catch (Exception ex) { string error = string.Format(CultureInfo.InvariantCulture, "Failed populating oe children. error:{0} inner:{1} stacktrace:{2}", ex.Message, ex.InnerException != null ? ex.InnerException.Message : "", ex.StackTrace); diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs index 62b7e0ba..49ea5721 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs @@ -332,7 +332,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer } - internal async Task ExpandNode(ObjectExplorerSession session, string nodePath, bool forceRefresh = false) + internal async Task ExpandNode(ObjectExplorerSession session, string nodePath, bool forceRefresh = false) { return await Task.Factory.StartNew(() => { @@ -349,7 +349,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer nodes = node.Expand().Select(x => x.ToNodeInfo()).ToArray(); } } - return nodes; + return new ExpandResponse { Nodes = nodes, ErrorMessage = node.ErrorMessage, SessionId = session.Uri, NodePath = nodePath }; }); } @@ -383,7 +383,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer { // open connection based on request details ConnectionCompleteParams result = await connectionService.Connect(connectParams); - connectionErrorMessage = result != null ? result.Messages : string.Empty; + connectionErrorMessage = result != null ? $"{result.Messages} error code:{result.ErrorNumber}" : string.Empty; if (result != null && !string.IsNullOrEmpty(result.ConnectionId)) { return result; @@ -463,16 +463,14 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer private async Task ExpandNodeAsync(ObjectExplorerSession session, ExpandParams expandParams, CancellationToken cancellationToken, bool forceRefresh = false) { - NodeInfo[] nodes = null; - nodes = await ExpandNode(session, expandParams.NodePath, forceRefresh); + ExpandResponse response = null; + response = await ExpandNode(session, expandParams.NodePath, forceRefresh); if (cancellationToken.IsCancellationRequested) { - Logger.Write(LogLevel.Verbose, "OE expand canceled "); + Logger.Write(LogLevel.Verbose, "OE expand canceled"); } else { - ExpandResponse response = CreateExpandResponse(session, expandParams); - response.Nodes = nodes; await serviceHost.SendEvent(ExpandCompleteNotification.Type, response); } } diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/DatabaseTreeNode.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/DatabaseTreeNode.cs index bd12bcaf..ee92cfa3 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/DatabaseTreeNode.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/DatabaseTreeNode.cs @@ -4,7 +4,10 @@ // +using System; +using System.Globalization; using Microsoft.SqlServer.Management.Smo; +using Microsoft.SqlTools.Utility; namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { @@ -34,5 +37,38 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } } } + + protected override void PopulateChildren(bool refresh, string name = null) + { + SmoQueryContext context = this.GetContextAs(); + if (IsAccessible(context)) + { + base.PopulateChildren(refresh, name); + } + else + { + ErrorMessage = string.Format(CultureInfo.InvariantCulture, SR.DatabaseNotAccessible, context.Database.Name); + } + } + + public bool IsAccessible(SmoQueryContext context) + { + try + { + if (context == null || context.Database == null) + { + return true; + } + return context.Database.IsAccessible; + } + catch (Exception ex) + { + return true; + string error = string.Format(CultureInfo.InvariantCulture, "Failed to get IsAccessible. error:{0} inner:{1} stacktrace:{2}", + ex.Message, ex.InnerException != null ? ex.InnerException.Message : "", ex.StackTrace); + Logger.Write(LogLevel.Error, error); + ErrorMessage = ex.Message; + } + } } } diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs index 839bffe1..bab0afb8 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs @@ -84,6 +84,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel IEnumerable queriers = context.ServiceProvider.GetServices(q => IsCompatibleQuerier(q)); var filters = this.Filters.ToList(); + var smoProperties = this.SmoProperties.Where(p => (p.ValidFor == 0 || p.ValidFor.HasFlag(validForFlag))).Select(x => x.Name); if (!string.IsNullOrEmpty(name)) { filters.Add(new NodeFilter @@ -98,7 +99,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel string propertyFilter = GetProperyFilter(filters, querier.GetType(), validForFlag); try { - var smoObjectList = querier.Query(context, propertyFilter, refresh).ToList(); + var smoObjectList = querier.Query(context, propertyFilter, refresh, smoProperties).ToList(); foreach (var smoObject in smoObjectList) { if (smoObject == null) @@ -239,6 +240,14 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } } + public override IEnumerable SmoProperties + { + get + { + return Enumerable.Empty(); + } + } + /// /// 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 diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQuerier.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQuerier.cs index c457c93e..72516a54 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQuerier.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQuerier.cs @@ -6,14 +6,9 @@ using System; using System.Collections.Generic; using System.Data; -using System.Globalization; -using System.Linq; using Microsoft.Data.Tools.DataSets; -using Microsoft.SqlServer.Management.Common; -using Microsoft.SqlServer.Management.Sdk.Sfc; using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlTools.Extensibility; -using Microsoft.SqlTools.Utility; namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { @@ -33,7 +28,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel /// /// /// - public abstract IEnumerable Query(SmoQueryContext context, string filter, bool refresh); + public abstract IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties); internal IMultiServiceProvider ServiceProvider { diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs index 3e0a9e97..425d57ff 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs @@ -19,7 +19,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Server parentServer = context.Parent as Server; if (parentServer != null) @@ -27,7 +27,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServer.Databases; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); } } @@ -42,7 +42,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Server parentServer = context.Parent as Server; if (parentServer != null) @@ -50,7 +50,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServer.LinkedServers; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); } } @@ -65,7 +65,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Server parentServer = context.Parent as Server; if (parentServer != null) @@ -73,7 +73,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServer.Logins; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); } } @@ -88,7 +88,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Server parentServer = context.Parent as Server; if (parentServer != null) @@ -96,7 +96,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServer.Roles; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); } } @@ -111,7 +111,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Server parentServer = context.Parent as Server; if (parentServer != null) @@ -119,7 +119,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServer.Credentials; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); } } @@ -134,7 +134,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Server parentServer = context.Parent as Server; if (parentServer != null) @@ -142,7 +142,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServer.CryptographicProviders; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); } } @@ -157,7 +157,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Server parentServer = context.Parent as Server; if (parentServer != null) @@ -165,7 +165,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServer.Audits; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); } } @@ -180,7 +180,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Server parentServer = context.Parent as Server; if (parentServer != null) @@ -188,7 +188,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServer.ServerAuditSpecifications; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); } } @@ -203,7 +203,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Server parentServer = context.Parent as Server; if (parentServer != null) @@ -211,7 +211,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServer.Endpoints; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); } } @@ -226,7 +226,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Server parentServer = context.Parent as Server; if (parentServer != null) @@ -234,7 +234,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServer.LinkedServers; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); } } @@ -249,7 +249,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Server parentServer = context.Parent as Server; if (parentServer != null) @@ -257,7 +257,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServer.Triggers; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); } } @@ -272,7 +272,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Server parentServer = context.Parent as Server; if (parentServer != null) @@ -280,7 +280,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServer.UserDefinedMessages; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); } } @@ -295,7 +295,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -303,7 +303,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.Tables; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { "IsSystemVersioned" }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -318,7 +318,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Table parentTable = context.Parent as Table; if (parentTable != null) @@ -326,7 +326,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentTable.Parent.Tables; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper
(retValue).Where(c => PassesFinalFilters(parentTable, c)); } } @@ -341,7 +341,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -349,7 +349,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.Views; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -364,7 +364,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -372,7 +372,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.Synonyms; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -387,7 +387,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { TableViewTableTypeBase parentTableViewTableTypeBase = context.Parent as TableViewTableTypeBase; if (parentTableViewTableTypeBase != null) @@ -395,7 +395,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentTableViewTableTypeBase.Columns; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTableViewTableTypeBase, c)); } } @@ -410,7 +410,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { TableViewTableTypeBase parentTableViewTableTypeBase = context.Parent as TableViewTableTypeBase; if (parentTableViewTableTypeBase != null) @@ -418,7 +418,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentTableViewTableTypeBase.Indexes; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTableViewTableTypeBase, c)); } } @@ -433,7 +433,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Table parentTable = context.Parent as Table; if (parentTable != null) @@ -441,7 +441,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentTable.Checks; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTable, c)); } } @@ -456,7 +456,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Table parentTable = context.Parent as Table; if (parentTable != null) @@ -464,7 +464,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentTable.ForeignKeys; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTable, c)); } } @@ -479,7 +479,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Column parentColumn = context.Parent as Column; if (parentColumn != null) @@ -505,7 +505,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Table parentTable = context.Parent as Table; if (parentTable != null) @@ -513,7 +513,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentTable.Triggers; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTable, c)); } } @@ -528,7 +528,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Table parentTable = context.Parent as Table; if (parentTable != null) @@ -554,7 +554,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { TableViewBase parentTableViewBase = context.Parent as TableViewBase; if (parentTableViewBase != null) @@ -562,7 +562,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentTableViewBase.Statistics; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTableViewBase, c)); } } @@ -577,7 +577,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -585,7 +585,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.Triggers; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -600,7 +600,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -608,7 +608,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.Assemblies; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -623,7 +623,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -631,7 +631,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.Sequences; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -646,7 +646,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -654,7 +654,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.UserDefinedDataTypes; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -669,7 +669,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -677,7 +677,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.UserDefinedTableTypes; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -692,7 +692,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -700,7 +700,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.XmlSchemaCollections; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -715,7 +715,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -723,7 +723,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.UserDefinedTypes; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -738,7 +738,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -746,7 +746,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.UserDefinedFunctions; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -761,7 +761,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -769,7 +769,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.UserDefinedAggregates; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -784,7 +784,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -792,7 +792,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.FileGroups; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -807,7 +807,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { FileGroup parentFileGroup = context.Parent as FileGroup; if (parentFileGroup != null) @@ -815,7 +815,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentFileGroup.Files; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentFileGroup, c)); } } @@ -830,7 +830,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -838,7 +838,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.FullTextCatalogs; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -853,7 +853,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -861,7 +861,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.FullTextStopLists; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -876,7 +876,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -884,7 +884,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.PartitionFunctions; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -899,7 +899,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -907,7 +907,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.PartitionSchemes; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -922,7 +922,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -930,7 +930,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.SearchPropertyLists; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -945,7 +945,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -953,7 +953,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.Users; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -968,7 +968,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -976,7 +976,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.Schemas; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -991,7 +991,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -999,7 +999,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.AsymmetricKeys; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -1014,7 +1014,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1022,7 +1022,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.Certificates; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -1037,7 +1037,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1045,7 +1045,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.SymmetricKeys; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -1060,7 +1060,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1086,7 +1086,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1112,7 +1112,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1120,7 +1120,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.DatabaseAuditSpecifications; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -1135,7 +1135,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1143,7 +1143,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.SecurityPolicies; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -1158,7 +1158,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1166,7 +1166,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.DatabaseScopedCredentials; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -1181,7 +1181,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1189,7 +1189,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.Roles; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -1204,7 +1204,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1212,7 +1212,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.ApplicationRoles; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -1227,7 +1227,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1235,7 +1235,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.ColumnMasterKeys; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -1250,7 +1250,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1258,7 +1258,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.ColumnEncryptionKeys; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -1273,7 +1273,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1299,7 +1299,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { ServiceBroker parentServiceBroker = context.Parent as ServiceBroker; if (parentServiceBroker != null) @@ -1307,7 +1307,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServiceBroker.Services; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); } } @@ -1322,7 +1322,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { ServiceBroker parentServiceBroker = context.Parent as ServiceBroker; if (parentServiceBroker != null) @@ -1330,7 +1330,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServiceBroker.ServiceContracts; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); } } @@ -1345,7 +1345,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { ServiceBroker parentServiceBroker = context.Parent as ServiceBroker; if (parentServiceBroker != null) @@ -1353,7 +1353,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServiceBroker.Queues; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); } } @@ -1368,7 +1368,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { ServiceBroker parentServiceBroker = context.Parent as ServiceBroker; if (parentServiceBroker != null) @@ -1376,7 +1376,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServiceBroker.RemoteServiceBindings; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); } } @@ -1391,7 +1391,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { ServiceBroker parentServiceBroker = context.Parent as ServiceBroker; if (parentServiceBroker != null) @@ -1399,7 +1399,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServiceBroker.Priorities; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); } } @@ -1414,7 +1414,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { ServiceBroker parentServiceBroker = context.Parent as ServiceBroker; if (parentServiceBroker != null) @@ -1422,7 +1422,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentServiceBroker.MessageTypes; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); } } @@ -1437,7 +1437,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1445,7 +1445,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.ExternalDataSources; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -1460,7 +1460,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1468,7 +1468,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.ExternalFileFormats; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -1483,7 +1483,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1491,7 +1491,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.StoredProcedures; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -1506,7 +1506,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1514,7 +1514,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.ExtendedStoredProcedures; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } @@ -1529,7 +1529,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { StoredProcedure parentStoredProcedure = context.Parent as StoredProcedure; if (parentStoredProcedure != null) @@ -1537,7 +1537,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentStoredProcedure.Parameters; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentStoredProcedure, c)); } } @@ -1547,7 +1547,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentUserDefinedAggregate.Parameters; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentUserDefinedAggregate, c)); } } @@ -1557,7 +1557,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentUserDefinedFunction.Parameters; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentUserDefinedFunction, c)); } } @@ -1572,7 +1572,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { PartitionFunction parentPartitionFunction = context.Parent as PartitionFunction; if (parentPartitionFunction != null) @@ -1580,7 +1580,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentPartitionFunction.PartitionFunctionParameters; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentPartitionFunction, c)); } } @@ -1595,7 +1595,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override Type[] SupportedObjectTypes { get { return supportedTypes; } } - public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh) + public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { Database parentDatabase = context.Parent as Database; if (parentDatabase != null) @@ -1603,7 +1603,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel var retValue = parentDatabase.Parent.SystemDataTypes; if (retValue != null) { - retValue.InitializeCollection(filter, new string[] { }); + retValue.ClearAndInitialize(filter, extraProperties); return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); } } diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.tt b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.tt index 12b28944..0117a71b 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.tt +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.tt @@ -33,7 +33,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { XmlElement nodeElement = GetNodeElement(xmlFile, nodeName); IList parents = GetParents(nodeElement, xmlFile, nodeName); - string properties = GetProperties(nodeElement, xmlFile, nodeName); string nodeType = GetNodeType(nodeElement, nodeName); string queryBaseClass = "SmoQuerier"; @@ -51,7 +50,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel WriteLine(""); // Query impl - WriteLine("public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh)"); + WriteLine("public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties)"); WriteLine("{"); PushIndent(indent); @@ -75,7 +74,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (IsCollection(nodeElement)) { - WriteLine(string.Format("retValue.InitializeCollection(filter, new string[] {{ {0} }});", properties)); + WriteLine(string.Format("retValue.ClearAndInitialize(filter, extraProperties);")); WriteLine(string.Format("return new SmoCollectionWrapper<{0}>(retValue).Where(c => PassesFinalFilters({1}, c));", nodeType, parentVar)); } else @@ -214,22 +213,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel return new string[] { "Database" }; } - public static string GetProperties(XmlElement nodeElement, string xmlFile, string parentName) - { - var propertiesAttr = nodeElement.GetAttribute("Properties"); - string result = string.Empty; - if (!string.IsNullOrEmpty(propertiesAttr)) - { - var properties = propertiesAttr.Split(';'); - foreach (var item in properties) - { - result = result + (string.IsNullOrEmpty(result) ? "" : ",") + "\"" + item + "\""; - } - - } - return result; - } - public static List GetChildren(string xmlFile, string parentName, string childNode) { XmlElement nodeElement = GetNodeElement(xmlFile, parentName); diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModelDefinition.xml b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModelDefinition.xml index 42932976..034067d7 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModelDefinition.xml +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModelDefinition.xml @@ -35,7 +35,7 @@ - + diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTableCustomNode.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTableCustomNode.cs index 7f97ef3c..7b9032b8 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTableCustomNode.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTableCustomNode.cs @@ -14,10 +14,17 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { public override string GetNodeCustomName(object smoObject, SmoQueryContext smoContext) { - Table table = smoObject as Table; - if (table != null && table.IsSystemVersioned) + try { - return $"{table.Schema}.{table.Name} ({SR.SystemVersioned_LabelPart})"; + Table table = smoObject as Table; + if (table != null && table.IsSystemVersioned) + { + return $"{table.Schema}.{table.Name} ({SR.SystemVersioned_LabelPart})"; + } + } + catch + { + //Ignore the exception and just not change create custom name } return string.Empty; diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/TreeNodeDefinition.xml b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/TreeNodeDefinition.xml index 419e03e8..8f62c523 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/TreeNodeDefinition.xml +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/TreeNodeDefinition.xml @@ -75,6 +75,9 @@ TableTemporalType.SystemVersioned + + +