Last post Feb 22, 2012 09:12 AM by thaicarrot
Feb 20, 2012 08:02 PM|sephiroth100|LINK
I've only been looking at the EF a week but the more I delve the more I find that there's either something fundamental missing, or that its been developed by 10 developers in different rooms... in different buildings.
I'm looking at optimisticconcurrency and can see at least 2 different ways of foing the same thing, but which ones is right in my case? I'm using EF 4.1, with an edmx from the database and DbContext rather than ObjectContext.
I've found 2 exceptions that fit the bill, the first is OptimisticConcurrencyException and the second
DbUpdateConcurrencyException.Here's the reload statement:
If there are multiple exceptions is this going to fail again - I'm not sure, anyone help?
Feb 22, 2012 02:21 AM|decker dong - msft|LINK
Would you mind showing us your codes and point out where the error is thrown out？
Feb 22, 2012 09:12 AM|thaicarrot|LINK
The Reload support for an instance of Entity not multiple. There's no refresh or Reload the whole data from database. Except you convert DbContext back to ObjectContext because DbContext base on ObjectContext.
How to solve.
Convert DbContext to ObjectContex
private ObjectContext objectContext;
private void RefreshExecute()
objectContext = ((IObjectContextAdapter)context).ObjectContext;
EF 4.1+ has been changing overtime so that is it still not consistency at the moment
EF 5 is best.