This project is read-only.

Create a new transaction scope (with content)

Topics: Core, General, Troubleshooting, Writing modules
Dec 17, 2012 at 2:00 PM

I wrapped my core around a new transaction scope (RequiresNew, ReadCommitted) and only 'Complete' it once all steps are OK.

In my opinion that should not commit anything to the database if I don't 'Complete' the scope but it still does that.

How can I, during an Orchard web request, do things in a separate transaction (so different from the 'per request') scope and roll back if needed?

Any aid is appreciated.

Dec 17, 2012 at 2:39 PM

Anyone who can aid me?

Dec 17, 2012 at 5:48 PM

Apparently not, sorry. Seems like if you're going to opt out of the Orchard transaction, you are then responsible for creating your own and committing or rolling back.

Dec 17, 2012 at 10:13 PM

You can fairly easily run code outside of the Orchard transaction with IProcessingEngine. More specifically, you can queue methods to be executed and they will be run when the request is over, in their own transaction (own transaction per method). See this module for an example.