diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-27 13:16:00 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-27 13:16:00 +0200 |
| commit | af8530c50d90c12ebe60383e67101920760c314f (patch) | |
| tree | 53e8f091a3cd8dc2235b38db527ef7798b9c347c /Software/Visual_Studio/Tango.Synchronization/Remote | |
| parent | 9d12fd0ba222619dd5b42816ed004c7b762809dd (diff) | |
| download | Tango-af8530c50d90c12ebe60383e67101920760c314f.tar.gz Tango-af8530c50d90c12ebe60383e67101920760c314f.zip | |
Fixed issue with local sync SQL Logic error.
Added some missing columns to SQLite db.
Direct Remote Sync is fully working !!!
Diffstat (limited to 'Software/Visual_Studio/Tango.Synchronization/Remote')
| -rw-r--r-- | Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs b/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs index 514948d57..84103af39 100644 --- a/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs +++ b/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs @@ -40,7 +40,7 @@ namespace Tango.Synchronization.Remote LogManager.Log("Querying all local configurations..."); var local_configurations = _localDB.CONFIGURATIONS.ToList(); LogManager.Log("Querying all local configuration dispensers..."); - var local_configurations_dispensers = _localDB.IDS_PACKS.ToList(); + var local_ids_packs = _localDB.IDS_PACKS.ToList(); LogManager.Log("Querying all local contacts..."); var local_contacts = _localDB.CONTACTS.ToList(); LogManager.Log("Querying all local dispensers..."); @@ -57,6 +57,8 @@ namespace Tango.Synchronization.Remote var local_users = _localDB.USERS.ToList(); LogManager.Log("Querying all local users roles..."); var local_users_roles = _localDB.USERS_ROLES.ToList(); + LogManager.Log("Querying all CATS..."); + var local_cats = _localDB.CATS.ToList(); LogManager.Log("Loading SQL Server database to memory..."); @@ -102,16 +104,20 @@ namespace Tango.Synchronization.Remote LogManager.Log("Querying all remote configurations dispensers..."); guids = remote_configurations.Select(x => x.GUID).ToList(); - var remote_configurations_dispensers = _remoteDB.IDS_PACKS.Where(x => guids.Contains(x.CONFIGURATION_GUID)).ToList(); + var remote_ids_packs = _remoteDB.IDS_PACKS.Where(x => guids.Contains(x.CONFIGURATION_GUID)).ToList(); LogManager.Log("Querying all remote dispensers..."); - guids = remote_configurations_dispensers.Select(x => x.DISPENSER_GUID).ToList(); + guids = remote_ids_packs.Select(x => x.DISPENSER_GUID).ToList(); var remote_dispensers = _remoteDB.DISPENSERS.Where(x => guids.Contains(x.GUID)).ToList(); LogManager.Log("Querying all remote cartridges..."); - guids = remote_configurations_dispensers.Select(x => x.CARTRIDGE_GUID).ToList(); + guids = remote_ids_packs.Select(x => x.CARTRIDGE_GUID).ToList(); var remote_cartridges = _remoteDB.CARTRIDGES.Where(x => guids.Contains(x.GUID)).ToList(); + LogManager.Log("Querying all remote CATS..."); + guids = remote_machines.Select(x => x.GUID).ToList(); + var remote_cats = _remoteDB.CATS.Where(x => guids.Contains(x.MACHINE_GUID)).ToList(); + foreach (var config in _remoteDB.SYNC_CONFIGURATIONS.Where(x => (SyncConfiguration)x.SYNC_TYPE == SyncConfiguration.OverwriteLocal)) { @@ -129,7 +135,7 @@ namespace Tango.Synchronization.Remote CompareCollections(remote_configurations, local_configurations, _remoteDB.CONFIGURATIONS, _localDB.CONFIGURATIONS); LogManager.Log("Comparing configurations dispensers"); - CompareCollections(remote_configurations_dispensers, local_configurations_dispensers, _remoteDB.IDS_PACKS, _localDB.IDS_PACKS); + CompareCollections(remote_ids_packs, local_ids_packs, _remoteDB.IDS_PACKS, _localDB.IDS_PACKS); LogManager.Log("Comparing contacts"); CompareCollections(remote_contacts, local_contacts, _remoteDB.CONTACTS, _localDB.CONTACTS); @@ -155,6 +161,9 @@ namespace Tango.Synchronization.Remote LogManager.Log("Comparing users roles"); CompareCollections(remote_users_roles, local_users_roles, _remoteDB.USERS_ROLES, _localDB.USERS_ROLES); + LogManager.Log("Comparing cats"); + CompareCollections(remote_cats, local_cats, _remoteDB.CATS, _localDB.CATS); + LogManager.Log("Comparison done!"); return _diffs; @@ -168,12 +177,11 @@ namespace Tango.Synchronization.Remote private void CopyEntity(Object source, Object destination) { - foreach (var prop in source.GetType().GetProperties().Where(x => x.PropertyType.IsPrimitive || x.PropertyType == typeof(String) || x.PropertyType == typeof(DateTime))) + foreach (var prop in source.GetType().GetProperties().Where(x => x.PropertyType.IsPrimitive || x.PropertyType == typeof(String) || x.PropertyType == typeof(DateTime) || x.PropertyType == typeof(byte[]))) { if (destination.GetType().GetProperty(prop.Name) == null) { - LogManager.Log(String.Format("Warning: property {0} not found on destination entity {1}!", prop.Name, destination.GetType().Name)); - continue; + throw LogManager.Log(new InvalidOperationException(String.Format("Property '{0}' not found on destination table '{1}'.", prop.Name, destination.GetType().Name))); } if (prop.PropertyType == typeof(Int64)) |
