none
Concurrency issue with one table causes insert to fail RRS feed

  • Question

  • Hi, I'm relatively new to LINQ, so please bear with me if I am missing something obvious ...

    I have a table (Subscription) in which some records may be updated.

    If there is a concurrency conflict with the SubmitChanges method (using ContinueOnConflict), in the catch block I write a message to a log table (SubscriptionsLog), using InsertOnSubmit.

    After the catch block, I have another try/catch block, in which I call SubmitChanges again, in an attempt to insert the message into the SubscriptionsLog table.  I expect that SubmitChanges will fail, because the concurrency conflict still exists with the Subscription table -- however, by using the ContinueOnConflict parameter, I figure that it will continue and save the records that have no conflict (including inserting into the SubscriptionsLog table), so I do not do anything in the catch block.

    However, the second SubmitChanges raises an exception and fails to insert into the SubscriptionsLog table.

    I am perfectly content to bypass updating the Subscription table when there is a conflict; however, I would like the insert into the SubscriptionsLog table to work.

    How can I resolve this? Is there any way to tell it to update only one table -- to forget about the one with the conflict?

    Thanks,
    Cynthia

    CynthiaD
    Monday, February 23, 2009 9:29 PM

Answers

  • OK, I found the answer -- I had to call the Resolve method.

    No harm, no foul -- sorry to take up the space!
    CynthiaD
    • Marked as answer by cedubose Monday, February 23, 2009 10:50 PM
    Monday, February 23, 2009 10:49 PM