I will be more specific here..
This is a strange problem and really, i am not understanding why this is happening..
In my data model every table has a column of type rowversion, and in my EDM (Entity Data Model) i enabled version to be my rowversion and maps exacly with my column rowversion in database.
Here is the problem.
1) I List items
2) I go update one item, (supose with id 4)
3) I send to the form in a hiddenfield the value of the rowversion
4) Someone updated in database some field in id 4 (making the rowversion to change)
5) I update the new values
6) i Convert string data with rowversion to byte[]
7) I get the object with primary key from the database and affect all properties of the object returned from database with model binded object that come from the form post including the rowversion!
8) I invoke SaveChanges()
9) The Problem!
I go to profiler and i see that the query that is build contains the Newer version and not the older (not that i affected from the post form to the object that come from the database).
For me appears that EF when is building is using the newVersion in some place, and not uses the current value that controls concurrency in the object..
Somebody know what it is happening????
Here is my workaround..
for persistance ignorant:
The essence is..
POCO don’t notify the context for changes, so when i update an entity, the entry still remains unchanged.