diff --git a/src/Microsoft.SqlTools.Hosting/Hosting/IHostedService.cs b/src/Microsoft.SqlTools.Hosting/Hosting/IHostedService.cs index f905a073..65556ccd 100644 --- a/src/Microsoft.SqlTools.Hosting/Hosting/IHostedService.cs +++ b/src/Microsoft.SqlTools.Hosting/Hosting/IHostedService.cs @@ -4,7 +4,6 @@ // using System; -using System.Diagnostics; using System.Threading.Tasks; using Microsoft.SqlTools.Extensibility; using Microsoft.SqlTools.Hosting.Protocol; @@ -70,7 +69,7 @@ namespace Microsoft.SqlTools.Hosting protected async Task HandleRequestAsync(Func> handler, RequestContext requestContext, string requestType) { - Logger.Write(TraceEventType.Verbose, requestType); + Logger.Verbose($"Handling request type {requestType}"); try { diff --git a/src/Microsoft.SqlTools.Hosting/Utility/Logger.cs b/src/Microsoft.SqlTools.Hosting/Utility/Logger.cs index 9a4cd9a8..98b1149a 100644 --- a/src/Microsoft.SqlTools.Hosting/Utility/Logger.cs +++ b/src/Microsoft.SqlTools.Hosting/Utility/Logger.cs @@ -239,6 +239,36 @@ namespace Microsoft.SqlTools.Utility /// The message text to be written. public static void Write(TraceEventType eventType, string logMessage) => Write(eventType, LogEvent.Default, logMessage); + /// + /// Writes a message to the log file with the Verbose event level + /// + /// The message text to be written. + public static void Verbose(string logMessage) => Write(TraceEventType.Verbose, logMessage); + + /// + /// Writes a message to the log file with the Information event level + /// + /// The message text to be written. + public static void Information(string logMessage) => Write(TraceEventType.Information, logMessage); + + /// + /// Writes a message to the log file with the Warning event level + /// + /// The message text to be written. + public static void Warning(string logMessage) => Write(TraceEventType.Warning, logMessage); + + /// + /// Writes a message to the log file with the Error event level + /// + /// The message text to be written. + public static void Error(string logMessage) => Write(TraceEventType.Error, logMessage); + + /// + /// Writes a message to the log file with the Critical event level + /// + /// The message text to be written. + public static void Critical(string logMessage) => Write(TraceEventType.Critical, logMessage); + /// /// Writes a message to the log file with accompanying callstack. /// diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNode.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNode.cs index 97f5af57..2c526737 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNode.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNode.cs @@ -343,7 +343,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes cancellationToken.ThrowIfCancellationRequested(); try { + Logger.Verbose($"Begin populate children for {this.GetNodePath()} using {factory.GetType()} factory"); IEnumerable items = factory.Expand(this, refresh, name, includeSystemObjects, cancellationToken); + Logger.Verbose($"End populate children for {this.GetNodePath()} using {factory.GetType()} factory"); if (items != null) { foreach (TreeNode item in items) diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs index c20166c0..a3a1fb1c 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs @@ -401,17 +401,20 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer // since we don't need to add any nodes under this section of the tree. if (node == null) { + Logger.Verbose($"No node returned from FindNodeByPath for {nodePath}"); response = new ExpandResponse { Nodes = new NodeInfo[] { }, ErrorMessage = string.Empty, SessionId = session.Uri, NodePath = nodePath }; response.Nodes = new NodeInfo[0]; return response; } else { + Logger.Verbose($"Got node from FindNodeByPath for {nodePath}"); response = new ExpandResponse { Nodes = new NodeInfo[] { }, ErrorMessage = node.ErrorMessage, SessionId = session.Uri, NodePath = nodePath }; } - + Logger.Verbose($"Before enter BuildingMetadataLock for {nodePath}"); if (node != null && Monitor.TryEnter(node.BuildingMetadataLock, LanguageService.OnConnectionWaitTimeout)) { + Logger.Verbose($"After enter BuildingMetadataLock for {nodePath}"); try { int timeout = (int)TimeSpan.FromSeconds(settings?.ExpandTimeout ?? ObjectExplorerSettings.DefaultExpandTimeout).TotalMilliseconds; @@ -423,10 +426,12 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer { if (forceRefresh) { + Logger.Verbose($"Forcing refresh for {nodePath}"); nodes = node.Refresh(cancelToken).Select(x => x.ToNodeInfo()).ToArray(); } else { + Logger.Verbose($"Expanding {nodePath}"); nodes = node.Expand(cancelToken).Select(x => x.ToNodeInfo()).ToArray(); } response.Nodes = nodes; @@ -446,8 +451,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer } return response; }); - + Logger.Verbose($"Queuing binding operation for {nodePath}"); queueItem.ItemProcessed.WaitOne(); + Logger.Verbose($"Done with binding operation for {nodePath}"); if (queueItem.GetResultAsT() != null) { response = queueItem.GetResultAsT(); diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs index 04546edf..542328ae 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs @@ -13,6 +13,7 @@ using System.Composition; using System.Linq; using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlServer.Management.Smo.Broker; +using Microsoft.SqlTools.Utility; using Index = Microsoft.SqlServer.Management.Smo.Index; namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel @@ -27,6 +28,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Database"); Server parentServer = context.Parent as Server; if (parentServer != null) { @@ -34,7 +36,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + Logger.Verbose("End query Database"); + return ret; } } return Enumerable.Empty(); @@ -50,6 +54,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query LinkedServer"); Server parentServer = context.Parent as Server; if (parentServer != null) { @@ -57,7 +62,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + Logger.Verbose("End query LinkedServer"); + return ret; } } return Enumerable.Empty(); @@ -73,6 +80,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Login"); Server parentServer = context.Parent as Server; if (parentServer != null) { @@ -80,7 +88,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + Logger.Verbose("End query Login"); + return ret; } } return Enumerable.Empty(); @@ -96,6 +106,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query ServerRole"); Server parentServer = context.Parent as Server; if (parentServer != null) { @@ -103,7 +114,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + Logger.Verbose("End query ServerRole"); + return ret; } } return Enumerable.Empty(); @@ -119,6 +132,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Credential"); Server parentServer = context.Parent as Server; if (parentServer != null) { @@ -126,7 +140,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + Logger.Verbose("End query Credential"); + return ret; } } return Enumerable.Empty(); @@ -142,6 +158,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query CryptographicProvider"); Server parentServer = context.Parent as Server; if (parentServer != null) { @@ -149,7 +166,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + Logger.Verbose("End query CryptographicProvider"); + return ret; } } return Enumerable.Empty(); @@ -165,6 +184,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Audit"); Server parentServer = context.Parent as Server; if (parentServer != null) { @@ -172,7 +192,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + Logger.Verbose("End query Audit"); + return ret; } } return Enumerable.Empty(); @@ -188,6 +210,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query ServerAuditSpecification"); Server parentServer = context.Parent as Server; if (parentServer != null) { @@ -195,7 +218,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + Logger.Verbose("End query ServerAuditSpecification"); + return ret; } } return Enumerable.Empty(); @@ -211,6 +236,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Endpoint"); Server parentServer = context.Parent as Server; if (parentServer != null) { @@ -218,7 +244,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + Logger.Verbose("End query Endpoint"); + return ret; } } return Enumerable.Empty(); @@ -234,6 +262,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query LinkedServer"); Server parentServer = context.Parent as Server; if (parentServer != null) { @@ -241,7 +270,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + Logger.Verbose("End query LinkedServer"); + return ret; } } return Enumerable.Empty(); @@ -260,6 +291,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query ServerDdlTrigger"); Server parentServer = context.Parent as Server; if (parentServer != null) { @@ -267,7 +299,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + Logger.Verbose("End query ServerDdlTrigger"); + return ret; } } return Enumerable.Empty(); @@ -283,6 +317,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query UserDefinedMessage"); Server parentServer = context.Parent as Server; if (parentServer != null) { @@ -290,7 +325,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServer, c)); + Logger.Verbose("End query UserDefinedMessage"); + return ret; } } return Enumerable.Empty(); @@ -306,6 +343,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Table"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -313,7 +351,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper
(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query Table"); + return ret; } } return Enumerable.Empty(); @@ -329,6 +369,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Table"); Table parentTable = context.Parent as Table; if (parentTable != null) { @@ -336,7 +377,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper
(retValue).Where(c => PassesFinalFilters(parentTable, c)); + var ret = new SmoCollectionWrapper
(retValue).Where(c => PassesFinalFilters(parentTable, c)); + Logger.Verbose("End query Table"); + return ret; } } return Enumerable.Empty(); @@ -352,6 +395,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query View"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -359,7 +403,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query View"); + return ret; } } return Enumerable.Empty(); @@ -378,6 +424,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Synonym"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -385,7 +432,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query Synonym"); + return ret; } } return Enumerable.Empty(); @@ -401,6 +450,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Column"); TableViewTableTypeBase parentTableViewTableTypeBase = context.Parent as TableViewTableTypeBase; if (parentTableViewTableTypeBase != null) { @@ -408,7 +458,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTableViewTableTypeBase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTableViewTableTypeBase, c)); + Logger.Verbose("End query Column"); + return ret; } } return Enumerable.Empty(); @@ -424,6 +476,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Index"); TableViewTableTypeBase parentTableViewTableTypeBase = context.Parent as TableViewTableTypeBase; if (parentTableViewTableTypeBase != null) { @@ -431,7 +484,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTableViewTableTypeBase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTableViewTableTypeBase, c)); + Logger.Verbose("End query Index"); + return ret; } } return Enumerable.Empty(); @@ -447,6 +502,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Check"); Table parentTable = context.Parent as Table; if (parentTable != null) { @@ -454,7 +510,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTable, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTable, c)); + Logger.Verbose("End query Check"); + return ret; } } return Enumerable.Empty(); @@ -470,6 +528,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query ForeignKey"); Table parentTable = context.Parent as Table; if (parentTable != null) { @@ -477,7 +536,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTable, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTable, c)); + Logger.Verbose("End query ForeignKey"); + return ret; } } return Enumerable.Empty(); @@ -493,6 +554,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query DefaultConstraint"); Table parentTable = context.Parent as Table; if (parentTable != null) { @@ -509,7 +571,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel subFieldResult.Add(subField); } } - return subFieldResult.Where(c => PassesFinalFilters(parentTable, c)); + var ret = subFieldResult.Where(c => PassesFinalFilters(parentTable, c)); + Logger.Verbose("End query DefaultConstraint"); + return ret; } } UserDefinedTableType parentUserDefinedTableType = context.Parent as UserDefinedTableType; @@ -528,7 +592,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel subFieldResult.Add(subField); } } - return subFieldResult.Where(c => PassesFinalFilters(parentUserDefinedTableType, c)); + var ret = subFieldResult.Where(c => PassesFinalFilters(parentUserDefinedTableType, c)); + Logger.Verbose("End query DefaultConstraint"); + return ret; } } return Enumerable.Empty(); @@ -547,6 +613,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Trigger"); Table parentTable = context.Parent as Table; if (parentTable != null) { @@ -554,7 +621,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTable, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTable, c)); + Logger.Verbose("End query Trigger"); + return ret; } } View parentView = context.Parent as View; @@ -564,7 +633,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentView, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentView, c)); + Logger.Verbose("End query Trigger"); + return ret; } } return Enumerable.Empty(); @@ -583,6 +654,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query FullTextIndex"); Table parentTable = context.Parent as Table; if (parentTable != null) { @@ -609,6 +681,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Statistic"); TableViewBase parentTableViewBase = context.Parent as TableViewBase; if (parentTableViewBase != null) { @@ -616,7 +689,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTableViewBase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTableViewBase, c)); + Logger.Verbose("End query Statistic"); + return ret; } } return Enumerable.Empty(); @@ -635,6 +710,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query DatabaseDdlTrigger"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -642,7 +718,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query DatabaseDdlTrigger"); + return ret; } } return Enumerable.Empty(); @@ -658,6 +736,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query SqlAssembly"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -665,7 +744,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query SqlAssembly"); + return ret; } } return Enumerable.Empty(); @@ -681,6 +762,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Sequence"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -688,7 +770,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query Sequence"); + return ret; } } return Enumerable.Empty(); @@ -707,6 +791,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query UserDefinedDataType"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -714,7 +799,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query UserDefinedDataType"); + return ret; } } return Enumerable.Empty(); @@ -730,6 +817,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query UserDefinedTableType"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -737,7 +825,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query UserDefinedTableType"); + return ret; } } return Enumerable.Empty(); @@ -753,6 +843,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query XmlSchemaCollection"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -760,7 +851,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query XmlSchemaCollection"); + return ret; } } return Enumerable.Empty(); @@ -776,6 +869,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query UserDefinedType"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -783,7 +877,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query UserDefinedType"); + return ret; } } return Enumerable.Empty(); @@ -799,6 +895,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query UserDefinedFunction"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -806,7 +903,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query UserDefinedFunction"); + return ret; } } return Enumerable.Empty(); @@ -822,6 +921,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query UserDefinedAggregate"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -829,7 +929,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query UserDefinedAggregate"); + return ret; } } return Enumerable.Empty(); @@ -845,6 +947,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query FileGroup"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -852,7 +955,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query FileGroup"); + return ret; } } return Enumerable.Empty(); @@ -868,6 +973,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query DataFile"); FileGroup parentFileGroup = context.Parent as FileGroup; if (parentFileGroup != null) { @@ -875,7 +981,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentFileGroup, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentFileGroup, c)); + Logger.Verbose("End query DataFile"); + return ret; } } return Enumerable.Empty(); @@ -891,6 +999,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query FullTextCatalog"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -898,7 +1007,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query FullTextCatalog"); + return ret; } } return Enumerable.Empty(); @@ -914,6 +1025,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query FullTextStopList"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -921,7 +1033,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query FullTextStopList"); + return ret; } } return Enumerable.Empty(); @@ -937,6 +1051,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query PartitionFunction"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -944,7 +1059,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query PartitionFunction"); + return ret; } } return Enumerable.Empty(); @@ -960,6 +1077,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query PartitionScheme"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -967,7 +1085,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query PartitionScheme"); + return ret; } } return Enumerable.Empty(); @@ -983,6 +1103,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query SearchPropertyList"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -990,7 +1111,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query SearchPropertyList"); + return ret; } } return Enumerable.Empty(); @@ -1006,6 +1129,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query User"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1013,7 +1137,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query User"); + return ret; } } return Enumerable.Empty(); @@ -1029,6 +1155,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Schema"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1036,7 +1163,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query Schema"); + return ret; } } return Enumerable.Empty(); @@ -1052,6 +1181,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query AsymmetricKey"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1059,7 +1189,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query AsymmetricKey"); + return ret; } } return Enumerable.Empty(); @@ -1075,6 +1207,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Certificate"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1082,7 +1215,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query Certificate"); + return ret; } } return Enumerable.Empty(); @@ -1098,6 +1233,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query SymmetricKey"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1105,7 +1241,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query SymmetricKey"); + return ret; } } return Enumerable.Empty(); @@ -1121,6 +1259,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query DatabaseEncryptionKey"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1147,6 +1286,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query MasterKey"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1173,6 +1313,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query DatabaseAuditSpecification"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1180,7 +1321,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query DatabaseAuditSpecification"); + return ret; } } return Enumerable.Empty(); @@ -1196,6 +1339,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query SecurityPolicy"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1203,7 +1347,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query SecurityPolicy"); + return ret; } } return Enumerable.Empty(); @@ -1219,6 +1365,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query DatabaseScopedCredential"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1226,7 +1373,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query DatabaseScopedCredential"); + return ret; } } return Enumerable.Empty(); @@ -1242,6 +1391,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query DatabaseRole"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1249,7 +1399,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query DatabaseRole"); + return ret; } } return Enumerable.Empty(); @@ -1265,6 +1417,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query ApplicationRole"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1272,7 +1425,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query ApplicationRole"); + return ret; } } return Enumerable.Empty(); @@ -1288,6 +1443,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query ColumnMasterKey"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1295,7 +1451,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query ColumnMasterKey"); + return ret; } } return Enumerable.Empty(); @@ -1311,6 +1469,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query ColumnEncryptionKey"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1318,7 +1477,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query ColumnEncryptionKey"); + return ret; } } return Enumerable.Empty(); @@ -1334,6 +1495,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query ServiceBroker"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1360,6 +1522,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query BrokerService"); ServiceBroker parentServiceBroker = context.Parent as ServiceBroker; if (parentServiceBroker != null) { @@ -1367,7 +1530,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); + Logger.Verbose("End query BrokerService"); + return ret; } } return Enumerable.Empty(); @@ -1383,6 +1548,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query ServiceContract"); ServiceBroker parentServiceBroker = context.Parent as ServiceBroker; if (parentServiceBroker != null) { @@ -1390,7 +1556,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); + Logger.Verbose("End query ServiceContract"); + return ret; } } return Enumerable.Empty(); @@ -1406,6 +1574,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query ServiceQueue"); ServiceBroker parentServiceBroker = context.Parent as ServiceBroker; if (parentServiceBroker != null) { @@ -1413,7 +1582,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); + Logger.Verbose("End query ServiceQueue"); + return ret; } } return Enumerable.Empty(); @@ -1429,6 +1600,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query RemoteServiceBinding"); ServiceBroker parentServiceBroker = context.Parent as ServiceBroker; if (parentServiceBroker != null) { @@ -1436,7 +1608,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); + Logger.Verbose("End query RemoteServiceBinding"); + return ret; } } return Enumerable.Empty(); @@ -1452,6 +1626,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query BrokerPriority"); ServiceBroker parentServiceBroker = context.Parent as ServiceBroker; if (parentServiceBroker != null) { @@ -1459,7 +1634,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); + Logger.Verbose("End query BrokerPriority"); + return ret; } } return Enumerable.Empty(); @@ -1475,6 +1652,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query MessageType"); ServiceBroker parentServiceBroker = context.Parent as ServiceBroker; if (parentServiceBroker != null) { @@ -1482,7 +1660,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentServiceBroker, c)); + Logger.Verbose("End query MessageType"); + return ret; } } return Enumerable.Empty(); @@ -1498,6 +1678,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query ExternalDataSource"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1505,7 +1686,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query ExternalDataSource"); + return ret; } } return Enumerable.Empty(); @@ -1521,6 +1704,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query ExternalFileFormat"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1528,7 +1712,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query ExternalFileFormat"); + return ret; } } return Enumerable.Empty(); @@ -1544,6 +1730,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query StoredProcedure"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1551,7 +1738,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query StoredProcedure"); + return ret; } } return Enumerable.Empty(); @@ -1567,6 +1756,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query ExtendedStoredProcedure"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1574,7 +1764,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query ExtendedStoredProcedure"); + return ret; } } return Enumerable.Empty(); @@ -1590,6 +1782,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query Parameter"); StoredProcedure parentStoredProcedure = context.Parent as StoredProcedure; if (parentStoredProcedure != null) { @@ -1597,7 +1790,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentStoredProcedure, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentStoredProcedure, c)); + Logger.Verbose("End query Parameter"); + return ret; } } UserDefinedAggregate parentUserDefinedAggregate = context.Parent as UserDefinedAggregate; @@ -1607,7 +1802,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentUserDefinedAggregate, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentUserDefinedAggregate, c)); + Logger.Verbose("End query Parameter"); + return ret; } } UserDefinedFunction parentUserDefinedFunction = context.Parent as UserDefinedFunction; @@ -1617,7 +1814,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentUserDefinedFunction, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentUserDefinedFunction, c)); + Logger.Verbose("End query Parameter"); + return ret; } } return Enumerable.Empty(); @@ -1633,6 +1832,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query PartitionFunctionParameter"); PartitionFunction parentPartitionFunction = context.Parent as PartitionFunction; if (parentPartitionFunction != null) { @@ -1640,7 +1840,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentPartitionFunction, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentPartitionFunction, c)); + Logger.Verbose("End query PartitionFunctionParameter"); + return ret; } } return Enumerable.Empty(); @@ -1656,6 +1858,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties) { + Logger.Verbose("Begin query SystemDataType"); Database parentDatabase = context.Parent as Database; if (parentDatabase != null) { @@ -1663,7 +1866,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel if (retValue != null) { retValue.ClearAndInitialize(filter, extraProperties); - return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + var ret = new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentDatabase, c)); + Logger.Verbose("End query SystemDataType"); + return ret; } } return Enumerable.Empty(); diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.tt b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.tt index 1bfa0f0f..2f8d9f67 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.tt +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.tt @@ -22,6 +22,7 @@ using System.Composition; using System.Linq; using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlServer.Management.Smo.Broker; +using Microsoft.SqlTools.Utility; using Index = Microsoft.SqlServer.Management.Smo.Index; namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel @@ -67,7 +68,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel WriteLine("public override IEnumerable Query(SmoQueryContext context, string filter, bool refresh, IEnumerable extraProperties)"); WriteLine("{"); PushIndent(indent); - + WriteLine(string.Format("Logger.Verbose(\"Begin query {0}\");", nodeType)); // TODO Allow override of the navigation path foreach(var parentType in parents) { @@ -94,7 +95,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel WriteLine(string.Format("retValue.ClearAndInitialize(filter, extraProperties);")); if (string.IsNullOrEmpty(subField) ) { - WriteLine(string.Format("return new SmoCollectionWrapper<{0}>(retValue).Where(c => PassesFinalFilters({1}, c));", nodeType, parentVar)); + WriteLine(string.Format("var ret = new SmoCollectionWrapper<{0}>(retValue).Where(c => PassesFinalFilters({1}, c));", nodeType, parentVar)); + WriteLine(string.Format("Logger.Verbose(\"End query {0}\");", nodeType)); + WriteLine("return ret;"); } else { @@ -111,7 +114,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel WriteLine("}"); PopIndent(); WriteLine("}"); - WriteLine(string.Format("return subFieldResult.Where(c => PassesFinalFilters({1}, c));", nodeType, parentVar)); + WriteLine(string.Format("var ret = subFieldResult.Where(c => PassesFinalFilters({1}, c));", nodeType, parentVar)); + WriteLine(string.Format("Logger.Verbose(\"End query {0}\");", nodeType)); + WriteLine("return ret;"); } } else