When to use System.Transactions

G

Guest

Hi,

I have been reading through a lot of material online trying to figure out if
my current scenario warrants the use of transactions. I have a ASP.NET 2.0
site that performs a task consisting of two LDAP operations, a filesystem
operation and a database operation. If any of them fail they should roll
back. Currently I'm just doing this with basic logic, however I'm wondering
if I should try using the new system.transactions? I'm concerned though as
only one of the above operation actual supports transactions.

Thanks in advanced.
Bill
 
O

Oliver Sturm

Hello Bill,
Currently I'm just doing this with basic logic, however I'm wondering
if I should try using the new system.transactions? I'm concerned though as
only one of the above operation actual supports transactions.

One of the great things about System.Transactions is that it's an
extensible system. So you could, theoretically, create appropriate
rollback code yourself for those parts of the operation that don't support
transactions themselves, and use the System.Transactions infrastructure as
a very clean way of interfacing with the combined handling.

Of course it has to be said that it can be very difficult and/or
comparatively inefficient to create a transaction-enabled layer around a
subsystem that doesn't have any support for this itself, so you should
probably make sure you


Oliver Sturm
 
O

Oliver Sturm

[ I actually managed to send my previous post before it was finished, so
please disregard in favor of this second, complete, try. ]

Hello Bill,
Currently I'm just doing this with basic logic, however I'm wondering
if I should try using the new system.transactions? I'm concerned though as
only one of the above operation actual supports transactions.

One of the great things about System.Transactions is that it's an
extensible system. So you could, theoretically, create appropriate
rollback code yourself for those parts of the operation that don't support
transactions themselves, and use the System.Transactions infrastructure as
a very clean way of interfacing with the combined handling.

Of course it has to be said that it can be very difficult and/or
comparatively inefficient to create a transaction-enabled layer around a
subsystem that doesn't have any support for this itself, so you should
probably make sure you really have the requirement before you start
working on this.

A pretty long while back I had a look at taking part in
System.Transactions transactions, and I blogged about it here:

http://www.sturmnet.org/blog/archives/2005/02/07/systemtransactions1/

Later I found an article by Sahil Malik here:

http://www.codebetter.com/blogs/sahil.malik/archive/2005/04/28/62604.aspx

I'm sure there's more information about this to be found today, nearly two
years later, so the above will probably just be a quick intro, if at all.


Oliver Sturm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top