TransactionScope and multi-threading

前端 未结 2 1355
南方客
南方客 2020-12-03 04:40

I was wondering how you would use the TransactionScope class in the correct way when you are dealing with multithreading?

We create a new scope in our main thread an

2条回答
  •  难免孤独
    2020-12-03 04:49

    See MSDN:

    You should also use the TransactionScope and DependentTransaction class for applications that require the use of the same transaction across multiple function calls or multiple thread calls.

    So maybe look into DependentTransaction - in particular, there is a worker thread example, here.

提交回复
热议问题