aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-01-25 17:12:12 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-01-25 17:12:12 +0200
commit7426c54072d63e49eae8a8a9b9a1097c9ecefbd2 (patch)
tree6946ac76661c37e0aa95ed0d9ed0e2005d87c9e5
parent6a8a50b01383cf724822c3eb0135c1729fb2daed (diff)
downloadTango-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.
-rw-r--r--Software/DB/Tango.dbbin294912 -> 294912 bytes
-rw-r--r--Software/DB/Tango.mdfbin75497472 -> 75497472 bytes
-rw-r--r--Software/DB/Tango_log.ldfbin8388608 -> 8388608 bytes
-rw-r--r--Software/Visual_Studio/Tango.Synchronization/Local/LocalDBComparer.cs4
-rw-r--r--Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs18
-rw-r--r--Software/Visual_Studio/Tango.Synchronization/SyncConfiguration.cs4
-rw-r--r--Software/Visual_Studio/Tango.Synchronization/Tango.Synchronization.csproj4
7 files changed, 25 insertions, 5 deletions
diff --git a/Software/DB/Tango.db b/Software/DB/Tango.db
index 081f6ce61..14d90fcdf 100644
--- a/Software/DB/Tango.db
+++ b/Software/DB/Tango.db
Binary files differ
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf
index 330100d0b..b93b255d8 100644
--- a/Software/DB/Tango.mdf
+++ b/Software/DB/Tango.mdf
Binary files differ
diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf
index 7b95ce038..7c79ea466 100644
--- a/Software/DB/Tango_log.ldf
+++ b/Software/DB/Tango_log.ldf
Binary files differ
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>