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

@@ -18,7 +18,7 @@
<PackageReference Update="Microsoft.Azure.Management.Sql" Version="1.41.0-preview" />
<PackageReference Update="Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider" Version="1.1.1" />
<PackageReference Update="Microsoft.SqlServer.Management.SmoMetadataProvider" Version="170.8.0" />
<PackageReference Update="Microsoft.SqlServer.Management.SmoMetadataProvider" Version="170.9.0" />
<PackageReference Update="Microsoft.SqlServer.DacFx" Version="161.6373.0-preview" />
<PackageReference Update="Microsoft.Azure.Kusto.Data" Version="9.0.4" />
<PackageReference Update="Microsoft.Azure.Kusto.Language" Version="9.0.4" />
@@ -44,12 +44,12 @@
<PackageReference Update="coverlet.collector" Version="3.1.2" />
<PackageReference Update="coverlet.msbuild" Version="3.1.2" />
</ItemGroup>
<!-- When updating version of Dependencies in the below section, please also update the version in the following files:
packages\Microsoft.SqlTools.ManagedBatchParser\Microsoft.SqlTools.ManagedBatchParser.nuspec-->
<ItemGroup>
<PackageReference Update="Microsoft.Data.SqlClient" Version="5.0.1" />
<PackageReference Update="Microsoft.SqlServer.SqlManagementObjects" Version="170.8.0" />
<PackageReference Update="Microsoft.SqlServer.SqlManagementObjects" Version="170.9.0" />
<PackageReference Update="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Update="System.Configuration.ConfigurationManager" Version="6.0.0" />
</ItemGroup>

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;
}
}