Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Entity Framework 4.0 AddObject() Method Encounter OptimisticConcurrencyException

Entity Framework 4.0 AddObject() Method Encounter OptimisticConcurrencyException

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpquestionannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gujingshui
    wrote on last edited by
    #1

    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 auto increased identity when I Add a new record , Exception occrued 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()

    However,if I set the CientId column not as a identity column,every thing works fine Can anyone tell me why this problem happens? thanks in advance

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups