Fixed the issue with nodeType set to null for many sql objects in object explorer (#323)

* Fixed the issue with nodeType set to null for sql objects
This commit is contained in:
Leila Lali
2017-04-19 15:49:00 -07:00
committed by GitHub
parent 850cf8c3e4
commit 3fd4129488
7 changed files with 201 additions and 106 deletions

View File

@@ -58,10 +58,22 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
NodeValue = smoObject.Name;
ScriptSchemaObjectBase schemaBasecObject = smoObject as ScriptSchemaObjectBase;
ObjectMetadata = new Metadata.Contracts.ObjectMetadata();
ObjectMetadata.Name = smoObject.Name;
try
{
if(smoObject.Urn != null)
{
ObjectMetadata.MetadataTypeName = smoObject.Urn.Type;
}
}
catch
{
//Ignore the exception, sometimes the urn returns exception and I' not sure why
}
if (schemaBasecObject != null)
{
ObjectMetadata.MetadataTypeName = schemaBasecObject.Urn?.Type;
ObjectMetadata.Name = schemaBasecObject.Name;
ObjectMetadata.Schema = schemaBasecObject.Schema;
if (!string.IsNullOrEmpty(ObjectMetadata.Schema))
{