From dbe06a50d53927629ffe8296e436f6bca47ccc5c Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Fri, 17 Mar 2023 11:11:40 -0700 Subject: [PATCH] Expose parent node path of tree node (#1949) * expose parent node path * add comments --- .../ObjectExplorer/Contracts/NodeInfo.cs | 6 ++++++ .../ObjectExplorer/Nodes/TreeNode.cs | 1 + 2 files changed, 7 insertions(+) diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Contracts/NodeInfo.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Contracts/NodeInfo.cs index 5aebcfc6..ba5a879b 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Contracts/NodeInfo.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Contracts/NodeInfo.cs @@ -25,6 +25,12 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts /// public string NodePath { get; set; } + /// + /// The path of the parent node. This is going to be used by the client side to determine the parent node. + /// We are not referencing the parent node directly because the information needs to be passed between processes. + /// + public string ParentNodePath { get; set; } + /// /// The type of the node - for example Server, Database, Folder, Table /// diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNode.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNode.cs index cd07047e..0f50b99b 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNode.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNode.cs @@ -229,6 +229,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes IsLeaf = this.IsAlwaysLeaf, Label = this.Label, NodePath = this.GetNodePath(), + ParentNodePath = this.Parent?.GetNodePath() ?? "", NodeType = this.NodeType, Metadata = this.ObjectMetadata, NodeStatus = this.NodeStatus,