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
..I tried the dbSet.AsNoTracking(). But Still continue to get the ""System.InvalidOperationException: Attaching an entity of type 'NS.Models.EntityName' failed because another entity of the same type already has the same primary key value. This can happen when using the 'Attach' method or setting the state of an entity to 'Unchanged' or 'Modified' if any e........."

I can see that my "_dbSet.Local" has items in it. Even though I am setting the ObjectState to ObjectState.Modified before the Attach, the update still failed with the above error.

Any feedback will be appreciated.

thanks.

Viewing all articles
Browse latest Browse all 1539

Trending Articles



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