Due to SQL Server's SavePoints feature (SqlTransaction.Save()), I would like to use SqlTransactions in a very limited fashion (I REALLY need this functionality) while still using ambient transactions in all other places. I realize that this means that this code (and dependencies) are now SQL Server-specific - this is fine. However, I'd still prefer to follow the preferred ambient transactions in all other places for best practice purposes. (If we need to move to Oracle or something, then we'll need to rework this part of our code but don't want to rework the entire codebase.)
Is it possible to get a current SqlTransaction from Transaction.Current (which returns an object of type System.Transactions.Transaction) or some other way? (I may be wrong but I am guessing that this is ultimately the object that implements ambient Transaction object at run-time)
(related but different question I'm currently working on if you need more info on why)
As far as I can tell, this simply cannot be done. Given that I'm getting no response to this, I'm marking this as the answer. I could, still, be wrong. I simply cannot figure this one out, though, and don't have the time to look into it any further.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With