Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 transaction management (System.Transactions.Transaction)?

Update: I just talked to Sam over Twitter. It should work. I'll update it tomorrow morning (at work) with the details to see if anyone can figure out why my changes were still being committed to the db even when i never called complete.

like image 376
coding4fun Avatar asked Jul 28 '11 14:07

coding4fun


People also ask

What is Dapper used for?

Dapper is a popular simple object mapping tool. It is designed primarily to be used in scenarios where you want to work with data in a strongly typed fashion - as business objects in a .

What is Dapper wallet?

Dapper can be defined as a 'smart wallet' that supports ERC-721 token and a variety of ERC-20 tokens including EMONT (Etheremon), BNB (Binance), VEN (VeChain), and OMG (OmiseGo), to name a few. Dapper Labs uses the power of play for delivering blockchain-based experiences made for the real-world.

What is meet Dapper?

Dapper is the first blockchain interface that uses smart contract technology in the browser to make full custody over crypto assets safe and easy for everyday consumers. We built Dapper to make it easy to use the blockchain safely.


1 Answers

It was totally my fault and not fully understanding transactionscope. A connection is not automatically enlisted in transactionscope unless you open the connection within the transactionscope:

Automatic Enlistment

  using (var scope = new TransactionScope())   {       con.Open();                                       //update/delete/insert commands here       ...       scope.Complete();   } 

Manual Enlistment

    con.Open();     using (var scope = new TransactionScope())     {        con.EnlistTransaction(Transaction.Current);          //update/delte/insert statements here        ...        scope.Complete();     } 

Details can be found here: Details

like image 88
coding4fun Avatar answered Sep 18 '22 20:09

coding4fun