Reputation: 2595
.NET 4, EF 4
I have two related entities, Order and OrderLine. Order contains (has a reference to) OrderLine.
Public Class Order
Public Property OrderLine
End Class
There is one table for each entity in the database (order table, orderline table). Each table has a timestamp column and the EF4 model is set up with ConcurrencyMode = Fixed for the timestamp table of each column.
I make a change to the Order, but leave the OrderLine unchanged. When I call SaveChanges, it appears that EF4 generates an update query for the OrderLine even though nothing has changed on it. The end result is that the timestamp for the OrderLine gets updated by the database in response to the EF4 Update command, but nothing else is updated because nothing was changed on the OrderLine.
Is this the way EF4 is supposed to handle this? If it is, why?
Upvotes: 2
Views: 97
Reputation:
This is a known bug in EF4, you can try to contact MS for a hotfix. You can detach unmodified entities before saving, save, and then reattach the entities as a workaround. As far as I have been able to tell, it appears fixed in the Developer Preview of .NET Framework 4.5, but that is not licensed for production use.
Upvotes: 1