mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-16 17:23:38 -05:00
@@ -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<TreeNode> 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)
|
||||
|
||||
@@ -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<ExpandResponse>() != null)
|
||||
{
|
||||
response = queueItem.GetResultAsT<ExpandResponse>();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh, IEnumerable<string> 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
|
||||
|
||||
Reference in New Issue
Block a user