Exit a distributed transaction for one of my Entity Framework ObjectContexts
I am using NServiceBus with distributed transactions. This usually works fantastic. Either my post succeeds or fails. All or nothing.
However, I am also trying to write diagnostic data to my database. This is done for a separate ObjectContext. For this, I would like it to persist in the database regardless of the success or failure of the Distributed Transaction.
Is there a way to bind one (and only one) data context to a database outside of a distributed transaction? (And keep the rest in them?)
+3
source to share
3 answers
One option (if 3.0 is used) is to create UoW:
http://andreasohlund.net/2011/11/21/unit-of-work-in-nservicebus-3-0/
And there it suppresses the transaction and writes the log.
+1
source to share