public TEntity Get(TIdentity identity)
 {
     AssertDispatcherThread();
     return((from entity in GetAll().ToList()
             where _identifier.GetIdentity(entity).Equals(identity)
             select entity).FirstOrDefault());
 }
Example #2
0
        public TEntity Store(TEntity entity)
        {
            AssertDispatcherThread();
            var identity = _identifier.GetIdentity(entity);
            var val      = _store.Get(identity);

            if (val == null)
            {
                _store.Add(entity);
            }
            return(entity);
        }
        public TEntity Store(TEntity entity)
        {
            AssertDispatcherThread();
            var identity = _identifier.GetIdentity(entity);
            var existing = _store.Get(identity);

            if (existing != null)
            {
                // Conflict resolution and merging
            }
            else
            {
                _store.Add(entity);
            }

            return(entity);
        }
 public TEntity Get(TIdentity identity)
 {
     AssertDispatcherThread();
     return(GetAll().ToList().Where(entity => _identifier.GetIdentity(entity).Equals(identity)).FirstOrDefault());
 }