Example #1
0
        public void AddTrackedEntityIfMissing(TrackedEntity trackedEntity)
        {
            this.ThrowIfEntitiesNotLoaded();
            if (this.trackedEntities.Any(e => e.Equals(trackedEntity)))
            {
                return;
            }

            this.trackedEntities.Add(trackedEntity);
            this.SaveTrackedEntities();
        }
Example #2
0
        public void RemoveTrackedEntity(TrackedEntity trackedEntity)
        {
            this.ThrowIfEntitiesNotLoaded();
            var entity = this.trackedEntities.FirstOrDefault(e => e.Equals(trackedEntity));

            if (entity == null)
            {
                throw new EntityStorageException("Could not find the tracked entity to remove.");
            }

            this.trackedEntities.Remove(entity);
            this.SaveTrackedEntities();
        }
Example #3
0
 public bool Equals(TrackedEntity otherEntity)
 {
     return(this.Id.Equals(otherEntity.Id) && this.Type.Equals(otherEntity.Type));
 }