Esempio n. 1
0
        public void Add(T entity)
        {
            SyncronizedEntity <T> syncronizedEntity;

            if (!this.TryGetSyncronizedEntity(entity, out syncronizedEntity))
            {
                this.Add(SyncronizedEntity <T> .Create(entity));
            }
        }
Esempio n. 2
0
        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()));
        }
Esempio n. 3
0
 public bool TryGetSyncronizedEntity(T entity, out SyncronizedEntity <T> syncronizedEntity)
 {
     syncronizedEntity = this.FirstOrDefault(syncEntity => syncEntity.Entity.GetHashCode().Equals(entity.GetHashCode()));
     return(syncronizedEntity != null);
 }