mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Skip querying model database for Azure database prototypes. (#2095)
This commit is contained in:
@@ -1739,29 +1739,37 @@ WHERE do.database_id = @DbID
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
if (context.Server.DatabaseEngineType == DatabaseEngineType.SqlAzureDatabase)
|
||||||
|
{
|
||||||
|
// Azure instances don't have a model database we can query, so just use the defaults
|
||||||
|
this.originalState = new DatabaseData(context);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//First try to get the properties, if attempt fails get
|
try
|
||||||
//only the minimal set of properties by setting the DefaultInitFields value to false
|
{
|
||||||
this.originalState = new DatabaseData(context, "model");
|
//First try to get the properties, if attempt fails get
|
||||||
|
//only the minimal set of properties by setting the DefaultInitFields value to false
|
||||||
|
this.originalState = new DatabaseData(context, "model");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
//Now try again with the optimized(DefaultInitFields set to false) properties
|
||||||
|
context.Server.SetDefaultInitFields(typeof(Database), false);
|
||||||
|
this.originalState = new DatabaseData(context, "model");
|
||||||
|
//Set the DefaultInitFields to its original value
|
||||||
|
context.Server.SetDefaultInitFields(typeof(Database), databaseDefaultInitFields);
|
||||||
|
}
|
||||||
|
this.originalState.owner = String.Empty;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
//Now try again with the optimized(DefaultInitFields set to false) properties
|
|
||||||
context.Server.SetDefaultInitFields(typeof(Database), false);
|
|
||||||
this.originalState = new DatabaseData(context, "model");
|
|
||||||
//Set the DefaultInitFields to its original value
|
//Set the DefaultInitFields to its original value
|
||||||
context.Server.SetDefaultInitFields(typeof(Database), databaseDefaultInitFields);
|
context.Server.SetDefaultInitFields(typeof(Database), databaseDefaultInitFields);
|
||||||
|
this.originalState = new DatabaseData(context);
|
||||||
}
|
}
|
||||||
this.originalState.owner = String.Empty;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
//Set the DefaultInitFields to its original value
|
|
||||||
context.Server.SetDefaultInitFields(typeof(Database), databaseDefaultInitFields);
|
|
||||||
this.originalState = new DatabaseData(context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New database should not inherit ReadOnly from model database (Fix TFS 885072)
|
// New database should not inherit ReadOnly from model database (Fix TFS 885072)
|
||||||
|
|||||||
Reference in New Issue
Block a user