Open abhay-naik opened 2 months ago
Internally the framework uses AsyncLocal and ThreadStatic to make a transaction scope that is valid within the scope of the using and methods called from within the using scope (so the entire call-stack below).
You can also see this issue that discusses how "Transactions are passed down the call tree."
Be aware though that the Transaction scope works with "using" (it's an IDisposable) and not "await using" (it's not an IAsyncDisposable), so async/await code inside the transaction should be wrapped in a Task.Run(...)
I am planning to use your library and was checking your code. I am trying to use in web api environment , how do you make your transaction thread safe with shared static Transaction class? Please do let me know so that I can use your library without any worry