Exclude isLedger property check for Azure DBs for improving OE nodes expansion perf (#1798)

This commit is contained in:
Cheena Malhotra
2023-01-05 12:00:14 -08:00
committed by GitHub
parent a8f9219f09
commit 5ad48a59f1
3 changed files with 14 additions and 2 deletions
@@ -4,8 +4,11 @@
//
using System.Collections.Generic;
using Microsoft.SqlTools.Utility;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
using System.Diagnostics;
using System;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
@@ -35,14 +38,15 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
try
{
Database? db = smoObject as Database;
if (db != null && IsPropertySupported("IsLedger", smoContext, db, CachedSmoProperties) && db.IsLedger)
if (db != null && IsPropertySupported(nameof(db.IsLedger), smoContext, db, CachedSmoProperties) && db.IsLedger)
{
return "Ledger";
}
}
catch
catch (Exception e)
{
//Ignore the exception and just not change create custom name
Logger.Write(TraceEventType.Verbose, $"Error ignored when reading node subtype: {e.Message}");
}
return string.Empty;
@@ -213,6 +213,11 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
Name = "Status",
ValidFor = ValidForFlag.All
});
properties.Add(new NodeSmoProperty
{
Name = "IsLedger",
ValidFor = ValidForFlag.AllOnPrem
});
return properties;
}
}
@@ -11,6 +11,9 @@
</Filters>
<Properties>
<Property Name="Status" ValidFor="All"/>
<!--IsLedger property check is disabled on Azure databases to avoid making connections to databases individually
when listing databases in Object Explorer since it's value is not available from 'master' DB for all databases.-->
<Property Name="IsLedger" ValidFor="AllOnPrem"/>
</Properties>
<Child Name="SystemDatabases" IsSystemObject="1"/>
</Node>