public void Remove(T obj) { _toDelete.RemoveAll(x => obj.TransactionalListEquals(obj)); _toUpdate.RemoveAll(x => obj.TransactionalListEquals(obj)); _toAdd.RemoveAll(x => obj.TransactionalListEquals(obj)); if (BaseList.Any(x => x.TransactionalListEquals(obj))) { _toDelete.Add(obj); } }
public void AddOrUpdate(T obj) { _toDelete.RemoveAll(x => x.TransactionalListEquals(obj)); // clear from delete if exists _toUpdate.RemoveAll(x => x.TransactionalListEquals(obj)); // clear from update if exists _toAdd.RemoveAll(x => x.TransactionalListEquals(obj)); // clear from update if exists if (BaseList.Any(x => x.TransactionalListEquals(obj))) // check if update or add new { _toUpdate.Add(obj); } else { _toAdd.Add(obj); } }