Bump SMO to 170.9.0 (#1766)

* Add logging

* SMO 170.9.0
This commit is contained in:
Charles Gagnon
2022-11-21 18:41:02 -08:00
committed by GitHub
parent 3a5935df99
commit bd58d786b4
2 changed files with 9 additions and 8 deletions

View File

@@ -28,6 +28,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
// We detect that here and fall back to master
if (db.State == SqlSmoState.Creating && !IsDWGen3(db))
{
Logger.Information($"Database {databaseName} is in Creating state after initialization, defaulting to master for Object Explorer connections. This is expected when connecting to an Availability Group readable secondary");
db = new Database(serverNode.GetContextAs<SmoQueryContext>().Server, "master");
db.Refresh();
}
@@ -35,7 +36,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
}
/// <summary>
/// Initializes the context and sets its ValidFor property
/// Initializes the context and sets its ValidFor property
/// </summary>
protected override void EnsureContextInitialized()
{
@@ -78,7 +79,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
// IsAccessible is not set of DW Gen3 so exception is expected in this case
if (IsDWGen3(context?.Database))
{
{
return true;
}
else
@@ -89,14 +90,14 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
ErrorMessage = ex.Message;
return false;
}
}
}
private bool IsDWGen3(Database db)
{
return db != null
&& db.DatabaseEngineEdition == DatabaseEngineEdition.SqlDataWarehouse
return db != null
&& db.DatabaseEngineEdition == DatabaseEngineEdition.SqlDataWarehouse
&& db.ServerVersion.Major == 12;
}
}