adding metadata to object explorer node info (#320)

* adding metadata to oe node info
This commit is contained in:
Leila Lali
2017-04-19 08:32:39 -07:00
committed by GitHub
parent 96d46b5c09
commit 8c0885da88
16 changed files with 121 additions and 81 deletions

View File

@@ -49,8 +49,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
NodeValue = connectionSummary.ServerName;
IsAlwaysLeaf = false;
NodeType = NodeTypes.ServerInstance.ToString();
NodeTypeId = NodeTypes.ServerInstance;
NodeType = NodeTypes.Server.ToString();
NodeTypeId = NodeTypes.Server;
Label = GetConnectionLabel();
}

View File

@@ -56,6 +56,18 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
SmoObject = smoObject;
NodeValue = smoObject.Name;
ScriptSchemaObjectBase schemaBasecObject = smoObject as ScriptSchemaObjectBase;
ObjectMetadata = new Metadata.Contracts.ObjectMetadata();
if (schemaBasecObject != null)
{
ObjectMetadata.MetadataTypeName = schemaBasecObject.Urn?.Type;
ObjectMetadata.Name = schemaBasecObject.Name;
ObjectMetadata.Schema = schemaBasecObject.Schema;
if (!string.IsNullOrEmpty(ObjectMetadata.Schema))
{
NodeValue = $"{ObjectMetadata.Schema}.{smoObject.Name}";
}
}
}
public virtual NamedSmoObject GetParentSmoObject()

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<ServerExplorerTree>
<Node Name="ServerInstance" LocLabel="SR.SchemaHierarchy_ServerInstance" Image="Server">
<Node Name="Server" LocLabel="SR.SchemaHierarchy_ServerInstance" Image="Server">
<Child Name="Databases"/>
<Child Name="ServerLevelSecurity"/>
<Child Name="ServerLevelServerObjects"/>
@@ -49,7 +49,7 @@
<Node Name="ServerLevelServerTriggers" LocLabel="SR.SchemaHierarchy_ServerTriggers" BaseClass="ModelBased" Strategy="MultipleElementsOfType" ChildQuerierTypes="SqlServerDdlTrigger"/>
<Node Name="ServerLevelErrorMessages" LocLabel="SR.SchemaHierarchy_ErrorMessages" BaseClass="ModelBased" Strategy="MultipleElementsOfType" ChildQuerierTypes="SqlErrorMessage"/>
<Node Name="DatabaseInstance" LocLabel="string.Empty" Image="Database" BaseClass="ModelBased" IsAsyncLoad="" Strategy="CreateModel">
<Node Name="Database" LocLabel="string.Empty" Image="Database" BaseClass="ModelBased" IsAsyncLoad="" Strategy="CreateModel">
<Child Name="Tables"/>
<Child Name="Views"/>
<Child Name="Synonyms"/>
@@ -142,7 +142,7 @@
</Filters>
</Node>
<Node Name="TableInstance" LocLabel="string.Empty" BaseClass="ModelBased" IsAsyncLoad="" Strategy="MultipleElementsOfType" ChildQuerierTypes="SqlTable" TreeNode="HistoryTableInstanceTreeNode">
<Node Name="Table" LocLabel="string.Empty" BaseClass="ModelBased" IsAsyncLoad="" Strategy="MultipleElementsOfType" ChildQuerierTypes="SqlTable" TreeNode="HistoryTableInstanceTreeNode">
<!-- TODO Add special history table handling to only return related history table instead of all! Under Table, we directly show any related history tables.-->
<Filters>
<Filter Property="TemporalType" Type="Enum" ValidFor="Sql2016|SqlvNext|AzureV12">
@@ -158,14 +158,14 @@
</Node>
<!-- TODO This should use display item not ChildQuerierTypes -->
<Node Name="HistoryTableInstance" LocLabel="string.Empty" BaseClass="ModelBased" IsAsyncLoad="" Strategy="PopulateDetails" ChildQuerierTypes="SqlTable" ValidFor="Sql2016|SqlvNext|AzureV12">
<Node Name="HistoryTable" LocLabel="string.Empty" BaseClass="ModelBased" IsAsyncLoad="" Strategy="PopulateDetails" ChildQuerierTypes="SqlTable" ValidFor="Sql2016|SqlvNext|AzureV12">
<Child Name="Columns"/>
<Child Name="Indexes"/>
<Child Name="Statistics"/>
</Node>
<!-- TODO This should use display item not ChildQuerierTypes -->
<Node Name="ExternalTableInstance" LocLabel="string.Empty" BaseClass="ModelBased" IsAsyncLoad="" Strategy="PopulateDetails" ChildQuerierTypes="SqlTable" ValidFor="Sql2016|SqlvNext|AzureV12">
<Node Name="ExternalTable" LocLabel="string.Empty" BaseClass="ModelBased" IsAsyncLoad="" Strategy="PopulateDetails" ChildQuerierTypes="SqlTable" ValidFor="Sql2016|SqlvNext|AzureV12">
<Child Name="Columns"/>
<Child Name="Statistics"/>
</Node>
@@ -192,7 +192,7 @@
<Node Name="SystemViews" LocLabel="SR.SchemaHierarchy_SystemViews" BaseClass="ModelBased" IsMsShippedOwned="true" Strategy="MultipleElementsOfType" ChildQuerierTypes="SqlView" TreeNode="ViewInstanceTreeNode"/>
<Node Name="ViewInstance" LocLabel="string.Empty" BaseClass="ModelBased" IsAsyncLoad="" Strategy="PopulateDetails">
<Node Name="View" LocLabel="string.Empty" BaseClass="ModelBased" IsAsyncLoad="" Strategy="PopulateDetails">
<Child Name="Columns"/>
<Child Name="Triggers"/>
<Child Name="Indexes"/>
@@ -233,7 +233,7 @@
<Node Name="UserDefinedTypes" LocLabel="SR.SchemaHierarchy_UserDefinedTypes" BaseClass="ModelBased" Strategy="MultipleElementsOfType" ChildQuerierTypes="SqlUserDefinedType" ValidFor="Sql2005|Sql2008|Sql2012|Sql2014|Sql2016|SqlvNext|AzureV12"/>
<Node Name="XmlSchemaCollections" LocLabel="SR.SchemaHierarchy_XMLSchemaCollections" BaseClass="ModelBased" Strategy="MultipleElementsOfType" ChildQuerierTypes="SqlXmlSchemaCollection" ValidFor="Sql2005|Sql2008|Sql2012|Sql2014|Sql2016|SqlvNext|AzureV12"/>
<Node Name="UserDefinedTableTypeInstance" LocLabel="string.Empty" BaseClass="ModelBased" ChildQuerierTypes="" IsAsyncLoad="" Strategy="PopulateDetails">
<Node Name="UserDefinedTableType" LocLabel="string.Empty" BaseClass="ModelBased" ChildQuerierTypes="" IsAsyncLoad="" Strategy="PopulateDetails">
<Child Name="UserDefinedTableTypeColumns"/>
<Child Name="UserDefinedTableTypeKeys"/>
<Child Name="UserDefinedTableTypeConstraints"/>
@@ -267,7 +267,7 @@
<Child Name="SystemStoredProcedures"/>
</Node>
<Node Name="SystemStoredProcedures" LocLabel="SR.SchemaHierarchy_SystemStoredProcedures" BaseClass="ModelBased" IsMsShippedOwned="true" Strategy="MultipleElementsOfType" ChildQuerierTypes="SqlProcedure" TreeNode="StoredProcedureInstanceTreeNode"/>
<Node Name="StoredProcedureInstance" LocLabel="string.Empty" BaseClass="ModelBased" ChildQuerierTypes="" IsAsyncLoad="" Strategy="PopulateDetails">
<Node Name="StoredProcedure" LocLabel="string.Empty" BaseClass="ModelBased" ChildQuerierTypes="" IsAsyncLoad="" Strategy="PopulateDetails">
<Child Name="StoredProcedureParameters"/>
</Node>
<Node Name="StoredProcedureParameters" LocLabel="SR.SchemaHierarchy_Parameters" BaseClass="ModelBased" Strategy="StoredProcedureParameters" ChildQuerierTypes="SqlSubroutineParameter" DisableSort=""/>
@@ -279,7 +279,7 @@
</Filter>
</Filters>
</Node>
<Node Name="TableValuedFunctionInstance" LocLabel="string.Empty" BaseClass="ModelBased" ChildQuerierTypes="" IsAsyncLoad="" Strategy="PopulateDetails">
<Node Name="TableValuedFunction" LocLabel="string.Empty" BaseClass="ModelBased" ChildQuerierTypes="" IsAsyncLoad="" Strategy="PopulateDetails">
<Child Name="TableValuedFunctionParameters"/>
</Node>
<Node Name="TableValuedFunctionParameters" LocLabel="SR.SchemaHierarchy_Parameters" BaseClass="ModelBased" Strategy="FunctionParameters" ChildQuerierTypes="SqlSubroutineParameter" DisableSort=""/>
@@ -291,13 +291,13 @@
</Filter>
</Filters>
</Node>
<Node Name="ScalarValuedFunctionInstance" LocLabel="string.Empty" BaseClass="ModelBased" ChildQuerierTypes="" IsAsyncLoad="" Strategy="PopulateDetails">
<Node Name="ScalarValuedFunction" LocLabel="string.Empty" BaseClass="ModelBased" ChildQuerierTypes="" IsAsyncLoad="" Strategy="PopulateDetails">
<Child Name="ScalarValuedFunctionParameters"/>
</Node>
<Node Name="ScalarValuedFunctionParameters" LocLabel="SR.SchemaHierarchy_Parameters" BaseClass="ModelBased" Strategy="FunctionParameters" ChildQuerierTypes="SqlSubroutineParameter" DisableSort=""/>
<Node Name="AggregateFunctions" LocLabel="SR.SchemaHierarchy_AggregateFunctions" BaseClass="ModelBased" Strategy="MultipleElementsOfType" ChildQuerierTypes="SqlUserDefinedAggregate" TreeNode="AggregateFunctionInstanceTreeNode" ValidFor="Sql2005|Sql2008|Sql2012|Sql2014|Sql2016|SqlvNext|AzureV12"/>
<Node Name="AggregateFunctionInstance" LocLabel="string.Empty" BaseClass="ModelBased" ChildQuerierTypes="" IsAsyncLoad="" Strategy="PopulateDetails">
<Node Name="AggregateFunction" LocLabel="string.Empty" BaseClass="ModelBased" ChildQuerierTypes="" IsAsyncLoad="" Strategy="PopulateDetails">
<Child Name="AggregateFunctionParameters"/>
</Node>
<Node Name="AggregateFunctionParameters" LocLabel="SR.SchemaHierarchy_Parameters" BaseClass="ModelBased" Strategy="PopulateParentDetails" ChildQuerierTypes="SqlSubroutineParameter" DisableSort=""/>

View File

@@ -12,8 +12,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public DatabaseInstanceTreeNode() : base()
{
NodeValue = string.Empty;
this.NodeType = "DatabaseInstance";
this.NodeTypeId = NodeTypes.DatabaseInstance;
this.NodeType = "Database";
this.NodeTypeId = NodeTypes.Database;
OnInitialize();
}
}
@@ -23,8 +23,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public TableInstanceTreeNode() : base()
{
NodeValue = string.Empty;
this.NodeType = "TableInstance";
this.NodeTypeId = NodeTypes.TableInstance;
this.NodeType = "Table";
this.NodeTypeId = NodeTypes.Table;
OnInitialize();
}
}
@@ -34,8 +34,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public ViewInstanceTreeNode() : base()
{
NodeValue = string.Empty;
this.NodeType = "ViewInstance";
this.NodeTypeId = NodeTypes.ViewInstance;
this.NodeType = "View";
this.NodeTypeId = NodeTypes.View;
OnInitialize();
}
}
@@ -45,8 +45,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public UserDefinedTableTypeInstanceTreeNode() : base()
{
NodeValue = string.Empty;
this.NodeType = "UserDefinedTableTypeInstance";
this.NodeTypeId = NodeTypes.UserDefinedTableTypeInstance;
this.NodeType = "UserDefinedTableType";
this.NodeTypeId = NodeTypes.UserDefinedTableType;
OnInitialize();
}
}
@@ -56,8 +56,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public StoredProcedureInstanceTreeNode() : base()
{
NodeValue = string.Empty;
this.NodeType = "StoredProcedureInstance";
this.NodeTypeId = NodeTypes.StoredProcedureInstance;
this.NodeType = "StoredProcedure";
this.NodeTypeId = NodeTypes.StoredProcedure;
OnInitialize();
}
}
@@ -67,8 +67,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public TableValuedFunctionInstanceTreeNode() : base()
{
NodeValue = string.Empty;
this.NodeType = "TableValuedFunctionInstance";
this.NodeTypeId = NodeTypes.TableValuedFunctionInstance;
this.NodeType = "TableValuedFunction";
this.NodeTypeId = NodeTypes.TableValuedFunction;
OnInitialize();
}
}
@@ -78,8 +78,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public ScalarValuedFunctionInstanceTreeNode() : base()
{
NodeValue = string.Empty;
this.NodeType = "ScalarValuedFunctionInstance";
this.NodeTypeId = NodeTypes.ScalarValuedFunctionInstance;
this.NodeType = "ScalarValuedFunction";
this.NodeTypeId = NodeTypes.ScalarValuedFunction;
OnInitialize();
}
}
@@ -89,8 +89,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public AggregateFunctionInstanceTreeNode() : base()
{
NodeValue = string.Empty;
this.NodeType = "AggregateFunctionInstance";
this.NodeTypeId = NodeTypes.AggregateFunctionInstance;
this.NodeType = "AggregateFunction";
this.NodeTypeId = NodeTypes.AggregateFunction;
OnInitialize();
}
}
@@ -111,8 +111,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public ExternalTableInstanceTreeNode() : base()
{
NodeValue = string.Empty;
this.NodeType = "ExternalTableInstance";
this.NodeTypeId = NodeTypes.ExternalTableInstance;
this.NodeType = "ExternalTable";
this.NodeTypeId = NodeTypes.ExternalTable;
OnInitialize();
}
}
@@ -122,8 +122,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public ExternalResourceInstanceTreeNode() : base()
{
NodeValue = string.Empty;
this.NodeType = "ExternalResourceInstance";
this.NodeTypeId = NodeTypes.ExternalResourceInstance;
this.NodeType = "ExternalResource";
this.NodeTypeId = NodeTypes.ExternalResource;
OnInitialize();
}
}
@@ -133,8 +133,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public HistoryTableInstanceTreeNode() : base()
{
NodeValue = string.Empty;
this.NodeType = "HistoryTableInstance";
this.NodeTypeId = NodeTypes.HistoryTableInstance;
this.NodeType = "HistoryTable";
this.NodeTypeId = NodeTypes.HistoryTable;
OnInitialize();
}
}
@@ -143,7 +143,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
[Shared]
internal partial class ServerInstanceChildFactory : SmoChildFactoryBase
{
public override IEnumerable<string> ApplicableParents() { return new[] { "ServerInstance" }; }
public override IEnumerable<string> ApplicableParents() { return new[] { "Server" }; }
protected override void OnExpandPopulateFolders(IList<TreeNode> currentChildren, TreeNode parent)
{
@@ -578,7 +578,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
[Shared]
internal partial class DatabaseInstanceChildFactory : SmoChildFactoryBase
{
public override IEnumerable<string> ApplicableParents() { return new[] { "DatabaseInstance" }; }
public override IEnumerable<string> ApplicableParents() { return new[] { "Database" }; }
protected override void OnExpandPopulateFolders(IList<TreeNode> currentChildren, TreeNode parent)
{
@@ -1147,7 +1147,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
[Shared]
internal partial class TableInstanceChildFactory : SmoChildFactoryBase
{
public override IEnumerable<string> ApplicableParents() { return new[] { "TableInstance" }; }
public override IEnumerable<string> ApplicableParents() { return new[] { "Table" }; }
protected override void OnExpandPopulateFolders(IList<TreeNode> currentChildren, TreeNode parent)
{
@@ -1209,7 +1209,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
[Shared]
internal partial class HistoryTableInstanceChildFactory : SmoChildFactoryBase
{
public override IEnumerable<string> ApplicableParents() { return new[] { "HistoryTableInstance" }; }
public override IEnumerable<string> ApplicableParents() { return new[] { "HistoryTable" }; }
protected override void OnExpandPopulateFolders(IList<TreeNode> currentChildren, TreeNode parent)
{
@@ -1254,7 +1254,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
[Shared]
internal partial class ExternalTableInstanceChildFactory : SmoChildFactoryBase
{
public override IEnumerable<string> ApplicableParents() { return new[] { "ExternalTableInstance" }; }
public override IEnumerable<string> ApplicableParents() { return new[] { "ExternalTable" }; }
protected override void OnExpandPopulateFolders(IList<TreeNode> currentChildren, TreeNode parent)
{
@@ -1454,7 +1454,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
[Shared]
internal partial class ViewInstanceChildFactory : SmoChildFactoryBase
{
public override IEnumerable<string> ApplicableParents() { return new[] { "ViewInstance" }; }
public override IEnumerable<string> ApplicableParents() { return new[] { "View" }; }
protected override void OnExpandPopulateFolders(IList<TreeNode> currentChildren, TreeNode parent)
{
@@ -1875,7 +1875,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
[Shared]
internal partial class UserDefinedTableTypeInstanceChildFactory : SmoChildFactoryBase
{
public override IEnumerable<string> ApplicableParents() { return new[] { "UserDefinedTableTypeInstance" }; }
public override IEnumerable<string> ApplicableParents() { return new[] { "UserDefinedTableType" }; }
protected override void OnExpandPopulateFolders(IList<TreeNode> currentChildren, TreeNode parent)
{
@@ -2297,7 +2297,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
[Shared]
internal partial class StoredProcedureInstanceChildFactory : SmoChildFactoryBase
{
public override IEnumerable<string> ApplicableParents() { return new[] { "StoredProcedureInstance" }; }
public override IEnumerable<string> ApplicableParents() { return new[] { "StoredProcedure" }; }
protected override void OnExpandPopulateFolders(IList<TreeNode> currentChildren, TreeNode parent)
{
@@ -2375,7 +2375,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
[Shared]
internal partial class TableValuedFunctionInstanceChildFactory : SmoChildFactoryBase
{
public override IEnumerable<string> ApplicableParents() { return new[] { "TableValuedFunctionInstance" }; }
public override IEnumerable<string> ApplicableParents() { return new[] { "TableValuedFunction" }; }
protected override void OnExpandPopulateFolders(IList<TreeNode> currentChildren, TreeNode parent)
{
@@ -2453,7 +2453,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
[Shared]
internal partial class ScalarValuedFunctionInstanceChildFactory : SmoChildFactoryBase
{
public override IEnumerable<string> ApplicableParents() { return new[] { "ScalarValuedFunctionInstance" }; }
public override IEnumerable<string> ApplicableParents() { return new[] { "ScalarValuedFunction" }; }
protected override void OnExpandPopulateFolders(IList<TreeNode> currentChildren, TreeNode parent)
{
@@ -2531,7 +2531,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
[Shared]
internal partial class AggregateFunctionInstanceChildFactory : SmoChildFactoryBase
{
public override IEnumerable<string> ApplicableParents() { return new[] { "AggregateFunctionInstance" }; }
public override IEnumerable<string> ApplicableParents() { return new[] { "AggregateFunction" }; }
protected override void OnExpandPopulateFolders(IList<TreeNode> currentChildren, TreeNode parent)
{