public void Add(T entity) { SyncronizedEntity <T> syncronizedEntity; if (!this.TryGetSyncronizedEntity(entity, out syncronizedEntity)) { this.Add(SyncronizedEntity <T> .Create(entity)); } }
int IComparable <SyncronizedEntity <T> > .CompareTo(SyncronizedEntity <T> other) { if (this.SyncronizationId == Guid.Empty || other.LastSyncronized == null) { return(1); } if (this.LastSyncronized == null || this.LastSyncronized < other.LastSyncronized || other.SyncronizationId == null) { return(-1); } return(this.Entity.GetHashCode().CompareTo(other.Entity.GetHashCode())); }
public bool TryGetSyncronizedEntity(T entity, out SyncronizedEntity <T> syncronizedEntity) { syncronizedEntity = this.FirstOrDefault(syncEntity => syncEntity.Entity.GetHashCode().Equals(entity.GetHashCode())); return(syncronizedEntity != null); }