ServiceStack/ServiceStack.OrmLite — pull request #226 by southernprogrammer (2013-04-17 16:20:41+00:00)
Title: Use Single Connection Across Threads

If trying to use an OrmLiteConnection across threads and you are trying to use transactions the following use case could occur:

Service 1 Starts Transaction
Service 2 Does Work (so it's attached to the transaction)
Service 1 Doesn't Commit Transaction
Service 2's work is lost

I've created a new UseTransaction to be used in scenarios like this. This function takes an Action to be fired in a using block for OpenTransaction so that the action can block
Exec calls off of the same connection (in other threads) and can block other UseTransaction calls (in other threads). A few unit tests for UseTransaction were also added.