Fix for upgrade compat level double connection
This commit is contained in:
Родитель
f3c9dde0dc
Коммит
f6168ef0de
|
@ -183,7 +183,7 @@ namespace BismNormalizer.TabularCompare
|
|||
)
|
||||
)
|
||||
{
|
||||
returnTabularComparison.TargetTabularModel.Connect();
|
||||
returnTabularComparison.TargetTabularModel.TomConnect();
|
||||
returnTabularComparison.TargetTabularModel.TomDatabase.CompatibilityLevel = comparisonInfo.SourceCompatibilityLevel;
|
||||
returnTabularComparison.TargetTabularModel.TomDatabase.Update();
|
||||
returnTabularComparison.MetadataResyncRequired = true;
|
||||
|
|
|
@ -1406,18 +1406,27 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
|
|||
{
|
||||
if (table.TomTable.RefreshPolicy != null)
|
||||
{
|
||||
//Confirm the table with incremental refresh policy isn't going to be deleted anyway
|
||||
bool tableBeingDeletedAnyway = false;
|
||||
//Confirm the table with incremental refresh policy isn't going to be deleted (or updated to not have a refresh policy) anyway
|
||||
bool policyBeingDeletedAnyway = false;
|
||||
foreach (ComparisonObject comparisonObjectToCheck in _comparisonObjects)
|
||||
{
|
||||
if (comparisonObjectToCheck.TargetObjectName == table.Name && comparisonObjectToCheck.MergeAction == MergeAction.Delete)
|
||||
{
|
||||
tableBeingDeletedAnyway = true;
|
||||
policyBeingDeletedAnyway = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (comparisonObjectToCheck.TargetObjectName == table.Name && comparisonObjectToCheck.MergeAction == MergeAction.Update &&
|
||||
!_comparisonInfo.OptionsInfo.OptionRetainRefreshPolicy && !_comparisonInfo.OptionsInfo.OptionRetainPartitions &&
|
||||
_sourceTabularModel.Tables.ContainsName(table.Name) && _sourceTabularModel.Tables.FindByName(table.Name).TomTable.RefreshPolicy == null)
|
||||
//Condition above includes OptionRetainPartitions because otherwise removal of the policy wouldn't go through if there are partitions in it
|
||||
{
|
||||
policyBeingDeletedAnyway = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!tableBeingDeletedAnyway)
|
||||
if (!policyBeingDeletedAnyway)
|
||||
{
|
||||
OnValidationMessage(new ValidationMessageEventArgs($"Unable to delete expression {comparisonObject.TargetObjectName} because it is an incremental-refresh parameter and table {table.Name} contains an incremental-refresh policy.", ValidationMessageType.Expression, ValidationMessageStatus.Warning));
|
||||
return;
|
||||
|
|
|
@ -53,32 +53,11 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Connect to SSAS server and instantiate properties of the TabularModel object.
|
||||
/// Connect to AS server and instantiate properties of the TabularModel object.
|
||||
/// </summary>
|
||||
public void Connect()
|
||||
{
|
||||
this.Disconnect();
|
||||
|
||||
if (_connectionInfo.UseTmdlFolder)
|
||||
{
|
||||
_database = _connectionInfo.OpenDatabaseFromFolder();
|
||||
}
|
||||
else if (_connectionInfo.UseBimFile)
|
||||
{
|
||||
_database = _connectionInfo.OpenDatabaseFromFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
_server = new Server();
|
||||
_server.Connect(_connectionInfo.BuildConnectionString());
|
||||
|
||||
_database = _server.Databases.FindByName(_connectionInfo.DatabaseName);
|
||||
if (_database == null)
|
||||
{
|
||||
//Don't need try to load from project here as will already be done before instantiated Comparison
|
||||
throw new Amo.ConnectionException($"Could not connect to database {_connectionInfo.DatabaseName}");
|
||||
}
|
||||
}
|
||||
TomConnect();
|
||||
|
||||
//Shell model
|
||||
_model = new Model(this, _database.Model);
|
||||
|
@ -165,6 +144,35 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Connect only to AS server. Does not instantiate properties of the TabularModel object.
|
||||
/// </summary>
|
||||
public void TomConnect()
|
||||
{
|
||||
this.Disconnect();
|
||||
|
||||
if (_connectionInfo.UseTmdlFolder)
|
||||
{
|
||||
_database = _connectionInfo.OpenDatabaseFromFolder();
|
||||
}
|
||||
else if (_connectionInfo.UseBimFile)
|
||||
{
|
||||
_database = _connectionInfo.OpenDatabaseFromFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
_server = new Server();
|
||||
_server.Connect(_connectionInfo.BuildConnectionString());
|
||||
|
||||
_database = _server.Databases.FindByName(_connectionInfo.DatabaseName);
|
||||
if (_database == null)
|
||||
{
|
||||
//Don't need try to load from project here as will already be done before instantiated Comparison
|
||||
throw new Amo.ConnectionException($"Could not connect to database {_connectionInfo.DatabaseName}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeCalcDependenciesFromServer()
|
||||
{
|
||||
_calcDependencies.Clear();
|
||||
|
@ -710,6 +718,7 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
|
|||
else
|
||||
{
|
||||
tableTarget.TomTable.RefreshPolicy = tomTableTargetOrig.RefreshPolicy.Clone();
|
||||
retainPartitionsMessage = "Retain refresh policy option applied. " + retainPartitionsMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче