Object explorer notifications (#354)

* changing oe protocols to send notifications
This commit is contained in:
Leila Lali
2017-05-23 09:30:11 -07:00
committed by GitHub
parent 6920e6bfd3
commit 63372d327e
10 changed files with 482 additions and 293 deletions

View File

@@ -10,6 +10,14 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
internal partial class DatabaseTreeNode
{
public DatabaseTreeNode(ServerNode serverNode, string databaseName): this()
{
Parent = serverNode;
NodeValue = databaseName;
Database db = new Database(serverNode.GetContextAs<SmoQueryContext>().Server, this.NodeValue);
db.Refresh();
CacheInfoFromModel(db);
}
/// <summary>
/// Initializes the context and ensures that

View File

@@ -42,6 +42,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
string error = string.Format(CultureInfo.InvariantCulture, "Failed expanding oe children. parent:{0} error:{1} inner:{2} stacktrace:{3}",
parent != null ? parent.GetNodePath() : "", ex.Message, ex.InnerException != null ? ex.InnerException.Message : "", ex.StackTrace);
Logger.Write(LogLevel.Error, error);
throw ex;
}
finally
{
@@ -97,7 +98,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
string propertyFilter = GetProperyFilter(filters, querier.GetType(), validForFlag);
try
{
foreach (var smoObject in querier.Query(context, propertyFilter, refresh))
var smoObjectList = querier.Query(context, propertyFilter, refresh).ToList();
foreach (var smoObject in smoObjectList)
{
if (smoObject == null)
{
@@ -116,6 +118,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
string error = string.Format(CultureInfo.InvariantCulture, "Failed getting smo objects. parent:{0} querier: {1} error:{2} inner:{3} stacktrace:{4}",
parent != null ? parent.GetNodePath() : "", querier.GetType(), ex.Message, ex.InnerException != null ? ex.InnerException.Message : "", ex.StackTrace);
Logger.Write(LogLevel.Error, error);
throw ex;
}
}
}

View File

@@ -83,7 +83,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
string urn = string.Empty;
try
{
string parentUrn = smoObject.Urn;
string parentUrn = smoObject.Urn != null ? smoObject.Urn.Value : string.Empty;
urn = parentUrn != null ? $"{parentUrn.ToString()}/{objectName}" + filter : string.Empty;
if (!string.IsNullOrEmpty(urn))
@@ -102,6 +102,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
string error = string.Format(CultureInfo.InvariantCulture, "Failed getting urns. error:{0} inner:{1} stacktrace:{2}",
ex.Message, ex.InnerException != null ? ex.InnerException.Message : "", ex.StackTrace);
Logger.Write(LogLevel.Error, error);
throw ex;
}
return urns;