best practice for transactions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I'am developing an asp.net app that is using an sql server.

How should I deal with transactions? Should I do the transactions in my
stored procedures or should I use Serviced Components or...

Thanks
 
Julia,

Why do you think that Microsoft made such a lot of posibilities?

To give you a lot of bad practise?

Cor
 
¤ Hi,
¤ I'am developing an asp.net app that is using an sql server.
¤
¤ How should I deal with transactions? Should I do the transactions in my
¤ stored procedures or should I use Serviced Components or...

Depends. Any of the three are viable so it's really a matter of figuring out which one will work
best based upon the methods you are using to update your database.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
That all depends on exactly what your requirements are.

If you are only going to be doing updates to one database, then you should
not use serviced components. That means having to use COM+, and that is
unnecessary overhead.

If your updates will ever involve more then stored procedure, sql
statements, etc, then the easiest thing is just to use ADO.NET transactions
in your code.
 
Julia,

Tranasctions are like ice-cream

They come in many flavors, they are almost always fattening, and they are
kinda necessary ;-)

So the various flavors are

a) Implicit Tranasctions
b) Explicit Transactions in the API
c) Explicit Transactions in Stored procedures
d) System.Transactions - volatile
e) System.Transactions - pspe
f) System.Transactions - durable
g) Loosely coupled systems with home grown 2pc

... So which one do you pick? "The lowest one you can get away with". :)

There are certain very isolated incidents where explicit transactions may
actually outperform implicit transactions in a single user scenario, and
there are other nuances based on your exact design and requirements that
guide you to the final architectural choice. I would recommend reading up
Chapter 11 of my ADO.NET 2.0 book (see signature) where I talk about
transactions in depth.

- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
 
Back
Top