0

Assuming the decision to delete is independent and threadsafe, is it threadsafe to call DeleteOnSubmit in parallel?

All entities will be added to the delete in parallel, then the change will be submitted afterwards.

My testing hasn't shown a problem, but that doesn't inherently mean it's safe....

1 Answer 1

1

No.

LINQ to SQL itself is not thread-safe; nor are any of its methods.

4
  • Do you have a link describing this?
    – Matthew
    Commented Jun 6, 2013 at 21:57
  • I see that the datacontext is not threadsafe as a whole, because many things can be called from it. That doesn't mean that adding to the deletion list isn't threadsafe... does it?
    – Matthew
    Commented Jun 6, 2013 at 22:02
  • I highly doubt that it's thread-safe. Thread safe code does not happen by accident; it requires careful design and compromises. For example, what if the list resizes?
    – SLaks
    Commented Jun 6, 2013 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.