none
Entity Framework 4.0 AddObject() Method Encounter OptimisticConcurrencyException!!!!!!! RRS feed

  • Question

  • I'm now using EF 4.0,and I Create a sample Table Named TableB,Table B‘s PK is (Id,YearMonth,Time),and Column ClientId Has been set as Identity ,As the following two Pics show

    when I Add a new record , Exception occrued ,as the following pic show

    And the full callstack is

       在 System.Data.Mapping.Update.Internal.UpdateTranslator.ValidateRowsAffected(Int64 rowsAffected, UpdateCommand source)
       在 System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)
       在 System.Data.EntityClient.EntityAdapter.Update(IEntityStateManager entityCache)
       在 System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options)
       在 System.Data.Objects.ObjectContext.SaveChanges()

    If I set the CientId Column not a identity column,every thing works fine

    Can anyone tell me why this problem happens? thanks in advance

    Friday, February 10, 2012 2:48 AM

Answers