none
How to avoid duplicate entities exception? RRS feed

  • Question

  • I create Linq2Sql entities.
    I attach them to the existing DataContext one by one.
    If the entity with the same primary key has been attached I get an exception: "Cannot attach an entity with a key that is already in use."

    How can I check if the entity that I attach is already in the DataContext?
    Tuesday, January 6, 2009 2:37 PM

All replies