Transactional Efficiency in Code and DB

What is more efficient - to have IDbTransaction in .net-code or to process it in the database? What for?

What are the possible scenarios in which either should be used?

+5
source share
1 answer

When it comes to connection-based transactions ( IDbTransaction), the overall performance should be very similar, but by processing it in .NET code, you can conveniently distribute several database operations on the same connection. If you perform transaction management inside TSQL, you should really limit it to a single TSQL query. There may be an extra round trip for start / end, but it is unlikely to hurt you.

Quite rarely (these days) I manually wrote transactions based on TSQL - perhaps if I wrote something called directly by the server through the agent (and not from my own application code).

IDbTransaction TransactionScope . .net, , TransactionScope ( ), / ( ).

+3

All Articles