From 7426c54072d63e49eae8a8a9b9a1097c9ecefbd2 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 25 Jan 2018 17:12:12 +0200 Subject: Added Synchronization Configuration (SynchronizeToRemote) where rows synchronize but added only from local to remote.. JOBS, JOB_RUNS, SEGMENTS, BRUSH_STOPS. --- .../Tango.Synchronization/Remote/RemoteDBComparer.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'Software/Visual_Studio/Tango.Synchronization/Remote') 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 /// The slave set. private void CompareEntities(Master master, Slave slave, DbSet masterSet, DbSet 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); + } } } } -- cgit v1.3.1