none
EF 4.3.1 - Concurrency Mode = Fixed updates unchanged entity RRS feed

  • Question

  • Environment:
    Windows 7 SP1 x64
    Visual Studio 2010 SP1
    EF 4.3.1 + DbContext + database first.
    .NET 4 C# WinForms
    SQL 2005 SP3

    Partial database model:

    Background:

    I recently upgraded from EF4 to 4.3.1 along with converting to DbContext. During this conversion, I enabled Concurrency Mode=Fixed for all tables on the UpdateDate field (a DateTime). Previously with EF4, this was set to noneStorGeneratedPattern=Computed was also enabled for all tables on CreateDate, CreateLogin, CreateComputer fields (they have default values in the database).

    Problem:

    When updating a Label entity, EF attempts to update the Format entity associated to it even though it hasn't changed.  I have the database permissions configured so only a certain group of Administrators have permissions to update the Format table. This update failure in tern bubbles back from SQL to the application.  Using the SQL profiler, the EF  issues the following command:

    exec sp_executesql N'declare @p int
    update [dbo].[Format]
    set @p = 0
    where (([FormatID] = @0) and ([UpdateDate] = @1))
    select [CreateDate], [CreateLogin], [CreateComputer]
    from [dbo].[Format]
    where @@ROWCOUNT > 0 and [FormatID] = @0',N'@0 smallint,@1 datetime',@0=9,@1='2010-12-14 12:18:28.550'

    Once I change the Concurrency Mode=None for UpdateDate in the Format table, the error does not happen.  Yes, I've already read through http://social.msdn.microsoft.com/Forums/en/adodotnetentityframework/thread/e6a8bd4b-b4ad-4459-904b-db21f2e0e5ab but there isn't a clear solution to the problem either.

    Why is this occurring?


    • Edited by BSOD2600 Tuesday, June 19, 2012 6:32 PM
    Tuesday, June 19, 2012 6:31 PM

Answers

  • I can confirm hotfix http://support.microsoft.com/kb/2390624 resolved this issue.  Is there an ETA when this will be included in an official .NET update?

    For those without MS support contracts, use this link http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=2390624 to get the hotfix emailed to you. 

    • Marked as answer by BSOD2600 Tuesday, June 19, 2012 7:55 PM
    Tuesday, June 19, 2012 7:55 PM

All replies

  • I can confirm hotfix http://support.microsoft.com/kb/2390624 resolved this issue.  Is there an ETA when this will be included in an official .NET update?

    For those without MS support contracts, use this link http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=2390624 to get the hotfix emailed to you. 

    • Marked as answer by BSOD2600 Tuesday, June 19, 2012 7:55 PM
    Tuesday, June 19, 2012 7:55 PM
  • Hi BSOD2600,

    Welcome to MSDN Forum.

    I'm glad to hear that you have solved the issue, and thanks for your sharing.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, June 20, 2012 1:56 AM
    Moderator
  • Allen Li:

    When will MS release this as an official patch?  It's been well over a year since the hotfix was released.

    Monday, July 9, 2012 7:41 PM