diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.Synchronization/Remote')
| -rw-r--r-- | Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs b/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs index 59ac980ba..c75f5c003 100644 --- a/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs +++ b/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs @@ -317,7 +317,7 @@ namespace Tango.Synchronization.Remote if (masterDate > slaveDate) { - diff = new Diff(DiffAction.UpdateRowInSlave, "Update row in slave table " + typeof(Master).Name, () => + diff = new Diff(DiffAction.UpdateRowInSlave, "Update row in slave table " + typeof(Master).Name, () => { LogManager.Log("Updating row in slave table " + typeof(Master).Name); CopyEntity(master, slave); @@ -325,7 +325,7 @@ namespace Tango.Synchronization.Remote } else if (slaveDate > masterDate) { - diff = new Diff(DiffAction.UpdateRowInMaster, "Update row in master table " + typeof(Master).Name, () => + diff = new Diff(DiffAction.UpdateRowInMaster, "Update row in master table " + typeof(Master).Name, () => { LogManager.Log("Updating row in master table " + typeof(Master).Name); CopyEntity(slave, master); @@ -349,7 +349,14 @@ namespace Tango.Synchronization.Remote /// <param name="slaveSet">The slave set.</param> private void CompareEntities<Master, Slave>(Master master, Slave slave, DbSet<Master> masterSet, DbSet<Slave> slaveSet) where Master : class where Slave : class { - if (slave == null) + bool skipAddToSlave = false; + + if (slave == null && _remoteDB.SYNC_CONFIGURATIONS.ToList().Exists(x => (SyncConfiguration)x.SYNC_TYPE == SyncConfiguration.SynchronizeToRemote && x.TABLE_NAME.SingularizeMVC() == typeof(Master).Name)) + { + skipAddToSlave = true; + } + + if (slave == null && !skipAddToSlave) { _diffs.Add(new Diff(DiffAction.AddRowToSlave, "Add row to slave table " + typeof(Master).Name, () => { @@ -377,7 +384,10 @@ namespace Tango.Synchronization.Remote return; } - CompareEntities(master, slave); + if (slave != null && master != null) + { + CompareEntities(master, slave); + } } } } |
