Tags "transactionscope" Result

How to know if the code is inside TransactionScope?

What is the best way to know if the code block is inside TransactionScope? Is Transaction.Current a realiable way to do it or there are any subtleties? Is it possible to access internal ContextData.CurrentData.CurrentScope (in System.Transactions) with reflection? If yes, how? Thank you in advance. Solution Here is more reliable way (as I said, T

it1352 0 2019-05-06

How does TransactionScope work?

When Method1() instantiates a TransactionScope and calls Method2() that also instantiates a TransactionScope, how does .NET know both are in the same scope? I believe it doesn't use static methods internally otherwise it wouldn't work well on multithreaded applications like ASP.NET. Is it possible to create my own TransactionScope-like class or do

it1352 1 2019-05-15

SubSonic2.2 SharedDbConnectionScope and TransactionScope Transaction Confusion

ARGH!!! There seems to be a little confusion surrounding the SharedDbConnectionScope and TransactionScope objects to enable wrapping your SubSonic queries within a transaction. The docs suggest specifying the using SharedDbConnectionScope wrapped around the using TransactionScope... using(SharedDbConnectionScope scope = new SharedDbConnectionSc

it1352 0 2020-07-25

Get TransactionScope to work with async / await

I'm trying to integrate async / await into our service bus. I implemented a SingleThreadSynchronizationContext based on this example http://blogs.msdn.com/b/pfxteam/archive/2012/01/20/10259049.aspx. And it works fine, except for one thing : TransactionScope. I await for stuff inside the TransactionScope and it break the TransactionScope. Transact

it1352 2 2019-05-08

What is TransactionScope default Timeout value?

When i create a TransactionScope object as followed: using (TransactionScope ts = new TransactionScope()) { // Do stuff... } What is the default transaction timeout of the given ts object? Solution According to David Browne it is 1 minute TransactionScope’s default constructor defaults the isolation level to Serializable and the timeout t

it1352 3 2019-05-10

Transactionscope or IDbTransaction

EDIT: I am only accessing 1 database but a DTC transaction IS being created. I can see it in the DTC Transaction List GUI (Component services plugin). Why is this? I need to perform a transaction (several insert commands) against 1 database. Should I be using TransactionScope or IDbTransaction (connection.BeginTransaction)? TransactionScope see

it1352 3 2019-05-06

Dapper & TransactionScope?

I just started playing around with Dapper. So far i love it. Does dapper not work with TransactionScope? I noticed that even if i never call TransactionScope.Complete then my changes are still committed to the database. If TransactionScope isn't supported now is there any plans in the future to support it? If not then you have to use traditional tr

it1352 0 2020-10-14