Monday, April 19, 2010 8:49 AM
I've seen EF4 do what seems to be a redundant update command that I'm curious why it does that.
Take a look at Julie Lerman's Blog post on EF Table Splitting (http://thedatafarm.com/blog/data-access/ef-table-splitting-ndash-the-opposite-of-entity-splitting/).
In her SQL Profiler trace she has this command executed:
exec sp_executesql N'declare @p int
set @p = 0
where ([SalesOrderID] = @0)
select [SalesOrderNumber], [TotalDue]
where @@ROWCOUNT > 0 and [SalesOrderID] = @0',N'@0 int',@0=71774
What's the logic behind the update command, that is not updating any value?
- Moved by Jonathan Aneja -- MSFTModerator Thursday, June 24, 2010 11:11 PM (From:ADO.NET Entity Framework and LINQ to Entities (Pre-Release))
Tuesday, June 22, 2010 4:37 PM
We are having our Entity Framework 4 sessions fail, and it seems that these redundant updates are the cause. The undesired updates are forcing our _VERSION timestamp to be incremented and then we are receiving concurrency update errors - even on a local database with only one user testing. This has us really dismayed and disappointed. Why is this happening?
System.Data.OptimisticConcurrencyException was unhandled by user code
Message=Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.
at System.Data.Mapping.Update.Internal.UpdateTranslator.ValidateRowsAffected(Int64 rowsAffected, UpdateCommand source)
at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)
at System.Data.EntityClient.EntityAdapter.Update(IEntityStateManager entityCache)
at System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options)
at PwC.NDF.Data.EntityFramework.EntityFrameworkDAO`2.GetEntityKey(E domain)
at PwC.NDF.Data.EntityFramework.EntityFrameworkDAO`2.GetID(E domain)
Tuesday, November 02, 2010 7:38 PMI have the same problem. Did you find a solution?