Quantcast
Channel: URF - Unit of Work & (extensible/generic) Repositories Framework
Viewing all articles
Browse latest Browse all 1539

New Post: ICollectionView throw Entity Framework Attach exception

$
0
0
Problem resolved...

The Repository.cs has a internal IQueryable<TEntity> Select(.... I added the AsNoTracking() on this line:
_IQueryable<TEntity> query = dbSet.AsNoTracking();

Now when i update my object using:
public virtual void Update(TEntity entity)
        {
            var existing = _dbSet.Local;// NOW LOCAL IS NULL 

            entity.ObjectState = ObjectState.Modified;
            _dbSet.Attach(entity);//no exceptions here
            _context.SyncObjectState(entity);
        }

Viewing all articles
Browse latest Browse all 1539

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>