From 7322854c7b9e31ffbdb608ffba3fbb65b829b044 Mon Sep 17 00:00:00 2001 From: Leila Lali Date: Mon, 18 Jun 2018 11:36:24 -0700 Subject: [PATCH] fixed the bug with view triggers in object explorer (#639) --- .../ObjectExplorer/SmoModel/SmoQueryModel.cs | 10 ++++++++++ .../SmoModel/SmoQueryModelDefinition.xml | 5 ++++- .../Baselines/AllSqlObjects.txt | 1 + .../TestScripts/AllSqlObjects.sql | Bin 37544 -> 37932 bytes 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs index 837258e5..b6e43992 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs @@ -551,6 +551,16 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentTable, c)); } } + View parentView = context.Parent as View; + if (parentView != null) + { + var retValue = parentView.Triggers; + if (retValue != null) + { + retValue.ClearAndInitialize(filter, extraProperties); + return new SmoCollectionWrapper(retValue).Where(c => PassesFinalFilters(parentView, c)); + } + } return Enumerable.Empty(); } } diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModelDefinition.xml b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModelDefinition.xml index 7112a4bb..35223278 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModelDefinition.xml +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModelDefinition.xml @@ -57,7 +57,10 @@ - + + Table + View + diff --git a/test/Microsoft.SqlTools.ServiceLayer.Test.Common/TestData/ObjectExplorer/Baselines/AllSqlObjects.txt b/test/Microsoft.SqlTools.ServiceLayer.Test.Common/TestData/ObjectExplorer/Baselines/AllSqlObjects.txt index 37403474..8eba4bdc 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.Test.Common/TestData/ObjectExplorer/Baselines/AllSqlObjects.txt +++ b/test/Microsoft.SqlTools.ServiceLayer.Test.Common/TestData/ObjectExplorer/Baselines/AllSqlObjects.txt @@ -116,6 +116,7 @@ NodeType: Column Label: LastName (Name(nvarchar), not null) SubType: Status: NodeType: Column Label: Suffix (nvarchar(10), null) SubType: Status: NodeType: Column Label: JobTitle (nvarchar(50), not null) SubType: Status: NodeType: Column Label: AdditionalContactInfo (AdditionalContactInfoSchemaCollection, null) SubType: Status: +NodeType: Trigger Label: ViewTrigger SubType: Status: NodeType: Synonym Label: dbo.MyProduct SubType: Status: NodeType: StoredProcedure Label: dbo.uspGetList SubType: Status: NodeType: StoredProcedureParameter Label: @Product (varchar, Input, No default) SubType:Input Status: diff --git a/test/Microsoft.SqlTools.ServiceLayer.Test.Common/TestData/ObjectExplorer/TestScripts/AllSqlObjects.sql b/test/Microsoft.SqlTools.ServiceLayer.Test.Common/TestData/ObjectExplorer/TestScripts/AllSqlObjects.sql index 239025d4cabeda00a458b5244a897aa5598c50ac..af4eea41887db258c31514ebb58eba7c8d978e59 100644 GIT binary patch delta 252 zcmZ3nlxfWhrVT#vlXaT;q{A388B!U_8A2F}fUI;NOa-zO81fnNCNH#BpIjF$CeF*i z#o)={#}Euu<;vj5-~yEQXKjU*Mr0q zz_1u-b_tN>1vEVgXjUeWmje`2V6X*Zb)ZNpLoray5XeU83TMawy9uO@kWPp`SD;&6 Xz$Ume_)iXx5uZG-pJ#Jee2_5!|Cui+ delta 14 WcmZ3pf@#H4rVT#vn=d597y|$@Y6f!v