diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-25 17:12:12 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-25 17:12:12 +0200 |
| commit | 7426c54072d63e49eae8a8a9b9a1097c9ecefbd2 (patch) | |
| tree | 6946ac76661c37e0aa95ed0d9ed0e2005d87c9e5 /Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs | |
| parent | 6a8a50b01383cf724822c3eb0135c1729fb2daed (diff) | |
| download | Tango-7426c54072d63e49eae8a8a9b9a1097c9ecefbd2.tar.gz Tango-7426c54072d63e49eae8a8a9b9a1097c9ecefbd2.zip | |
Added Synchronization Configuration (SynchronizeToRemote) where rows synchronize but added only from local to remote..
JOBS, JOB_RUNS, SEGMENTS, BRUSH_STOPS.
Diffstat (limited to 'Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs')
| -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); + } } } } |
