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 | |
| 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')
4 files changed, 25 insertions, 5 deletions
diff --git a/Software/Visual_Studio/Tango.Synchronization/Local/LocalDBComparer.cs b/Software/Visual_Studio/Tango.Synchronization/Local/LocalDBComparer.cs index 79d3857ad..a279af337 100644 --- a/Software/Visual_Studio/Tango.Synchronization/Local/LocalDBComparer.cs +++ b/Software/Visual_Studio/Tango.Synchronization/Local/LocalDBComparer.cs @@ -59,7 +59,9 @@ namespace Tango.Synchronization.Local foreach (var row in sync_table.AsEnumerable()) { - if ((SyncConfiguration)row.Field<Int64>(Constants.SYNC_CONFIGURATION_SYNC_TYPE_COLUMN) == SyncConfiguration.Synchronize) + SyncConfiguration config = (SyncConfiguration)row.Field<Int64>(Constants.SYNC_CONFIGURATION_SYNC_TYPE_COLUMN); + + if (config == SyncConfiguration.Synchronize || config == SyncConfiguration.SynchronizeToRemote) { sync_tables.Add(MasterSQL.Tables.Single(x => x.TableName == row.Field<String>(Constants.SYNC_CONFIGURATION_TABLE_NAME_COLUMN))); } 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); + } } } } diff --git a/Software/Visual_Studio/Tango.Synchronization/SyncConfiguration.cs b/Software/Visual_Studio/Tango.Synchronization/SyncConfiguration.cs index 2262796b9..60bb0a4c0 100644 --- a/Software/Visual_Studio/Tango.Synchronization/SyncConfiguration.cs +++ b/Software/Visual_Studio/Tango.Synchronization/SyncConfiguration.cs @@ -19,5 +19,9 @@ namespace Tango.Synchronization /// Synchronize (Insert, Update) rows by LAST_UPDATED field. /// </summary> Synchronize, + /// <summary> + /// Synchronize (Insert, Update) rows by LAST_UPDATED field without adding rows from source to target. + /// </summary> + SynchronizeToRemote } } diff --git a/Software/Visual_Studio/Tango.Synchronization/Tango.Synchronization.csproj b/Software/Visual_Studio/Tango.Synchronization/Tango.Synchronization.csproj index e0a0e5e2d..9ab584ad0 100644 --- a/Software/Visual_Studio/Tango.Synchronization/Tango.Synchronization.csproj +++ b/Software/Visual_Studio/Tango.Synchronization/Tango.Synchronization.csproj @@ -93,6 +93,10 @@ <None Include="packages.config" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> <ProjectReference Include="..\Tango.DAL.Local\Tango.DAL.Local.csproj"> <Project>{0e0eef3e-8f4e-4f23-9d19-479fd8d76c12}</Project> <Name>Tango.DAL.Local</Name> |
