Skip to content

Commit

Permalink
Merge pull request #25 from CrossBreezeNL/feature/update-dbms-fix
Browse files Browse the repository at this point in the history
Added check on DBMS to only set it if it's different then target model.
  • Loading branch information
harmen-xb committed Aug 4, 2023
2 parents cfa74fc + a8d1c92 commit 6f21da9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion PowerDesigner_OData_AddIn/PdODataModelUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Windows.Forms;
using CrossBreeze.Tools.PowerDesigner.AddIn.OData.Forms;
using PdCommon;
using PdPDM;

namespace CrossBreeze.Tools.PowerDesigner.AddIn.OData
{
Expand Down Expand Up @@ -250,7 +251,15 @@ public void UpdatePdmModel(PdPDM.Model pdmModel)
oImportDataModel.ModelOptionsText = pdmModel.ModelOptionsText;
// If the DBMS is set on the existing model, set the same DBMS on the import model.
if (pdmModel.DBMS != null)
oImportDataModel.DBMS = pdmModel.DBMS;
{
DBMS targetDBMS = (PdPDM.DBMS)pdmModel.DBMS;
// Chech whether the target DBMS is different, cause setting the DBMS to the same results in an error during merge.
if (oImportDataModel.DBMS == null || !((PdPDM.DBMS)oImportDataModel.DBMS).Name.Equals(targetDBMS.Name))
{
_logger.Debug(string.Format("Updating DBMS to target model DBMS {0}.", targetDBMS.Name));
oImportDataModel.DBMS = pdmModel.DBMS;
}
}
// Update the new model from the metadata feed.
UpdatePdmModelFromODataMetadata(oImportDataModel, oDataMetadataFile.Location, oDataAuthType);

Expand Down

0 comments on commit 6f21da9

Please sign in to comment.