diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-14 13:19:03 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-14 13:19:03 +0200 |
| commit | d1fa1f1a2e26469a6bbb5b82ab614079beffcb52 (patch) | |
| tree | 5823e82075a6bd9c932457f79a6269395d45fe23 /Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs | |
| parent | dd4560b79e305772debf48cc76c9ba67af61f259 (diff) | |
| download | Tango-d1fa1f1a2e26469a6bbb5b82ab614079beffcb52.tar.gz Tango-d1fa1f1a2e26469a6bbb5b82ab614079beffcb52.zip | |
Added code comments for:
Synchronization.
Diffstat (limited to 'Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs b/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs index 5985eb393..3d9667676 100644 --- a/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs +++ b/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs @@ -11,6 +11,10 @@ using System.Collections; namespace Tango.Synchronization.Remote { + /// <summary> + /// Represents a Remote database to SQLite database comparison engine. + /// </summary> + /// <seealso cref="Tango.Synchronization.IDBComparer" /> public class RemoteDBComparer : IDBComparer { private remote.RemoteDB _remoteDB; @@ -18,6 +22,12 @@ namespace Tango.Synchronization.Remote private String _machineSerial; private List<Diff> _diffs; + /// <summary> + /// Initializes a new instance of the <see cref="RemoteDBComparer"/> class. + /// </summary> + /// <param name="remoteDB">The remote database.</param> + /// <param name="localDB">The local database.</param> + /// <param name="machineSerial">The machine serial number.</param> public RemoteDBComparer(remote.RemoteDB remoteDB, local.LocalDB localDB, String machineSerial) { _machineSerial = machineSerial; @@ -25,6 +35,11 @@ namespace Tango.Synchronization.Remote _localDB = localDB; } + /// <summary> + /// Performs a database comparison and returns a set of differences. + /// </summary> + /// <returns></returns> + /// <exception cref="Tango.Synchronization.DataBaseComparisonException">Could not locate machine on remote server " + _machineSerial</exception> public List<Diff> Compare() { _diffs = new List<Diff>(); @@ -164,12 +179,21 @@ namespace Tango.Synchronization.Remote return _diffs; } + /// <summary> + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// </summary> public void Dispose() { _remoteDB.Dispose(); _localDB.Dispose(); } + /// <summary> + /// Copies source entity properties to the destination entity. + /// </summary> + /// <param name="source">The source entity.</param> + /// <param name="destination">The destination entity.</param> + /// <exception cref="InvalidOperationException"></exception> 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) || x.PropertyType == typeof(byte[]))) @@ -190,6 +214,15 @@ namespace Tango.Synchronization.Remote } } + /// <summary> + /// Compares a collection of source entities to a collection of destination entities. + /// </summary> + /// <typeparam name="Master">The type of the aster.</typeparam> + /// <typeparam name="Slave">The type of the lave.</typeparam> + /// <param name="masterCollection">The master collection.</param> + /// <param name="slaveCollection">The slave collection.</param> + /// <param name="masterSet">The master set.</param> + /// <param name="slaveSet">The slave set.</param> private void CompareCollections<Master, Slave>(List<Master> masterCollection, List<Slave> slaveCollection, DbSet<Master> masterSet, DbSet<Slave> slaveSet) where Master : class where Slave : class { var slaveProp = typeof(Slave).GetProperty("GUID"); @@ -214,6 +247,10 @@ namespace Tango.Synchronization.Remote } } + /// <summary> + /// Overrides the table by the specified synchronization configuration. + /// </summary> + /// <param name="config">The configuration.</param> private void OverrideTable(remote.SYNC_CONFIGURATIONS config) { LogManager.Log("Generating table override difference for " + config.TABLE_NAME + "..."); @@ -237,6 +274,13 @@ namespace Tango.Synchronization.Remote }, null)); } + /// <summary> + /// Compares the specified entities. + /// </summary> + /// <typeparam name="Master">The type of the master.</typeparam> + /// <typeparam name="Slave">The type of the slave.</typeparam> + /// <param name="master">The master.</param> + /// <param name="slave">The slave.</param> private void CompareEntities<Master, Slave>(Master master, Slave slave) where Master : class where Slave : class { Diff diff = null; @@ -267,6 +311,15 @@ namespace Tango.Synchronization.Remote } } + /// <summary> + /// Compares the entities. + /// </summary> + /// <typeparam name="Master">The type of the master.</typeparam> + /// <typeparam name="Slave">The type of the slave.</typeparam> + /// <param name="master">The master.</param> + /// <param name="slave">The slave.</param> + /// <param name="masterSet">The master set.</param> + /// <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) |
