469,578 Members | 1,287 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

Should I use TransactionScope?

Hi,

I'd really like to use TransactionScope within the Business Layer of
my web application. A book I'm reading makes a note that it should not
be used in a shared web hosting environment because the server may get
re-configured. Can anyone elaborate on this?

Regards,

Chris

May 10 '07 #1
4 5384
Chris,

I don't see how the server becoming reconfigured affects the use of
TransactionScope.

You want to use the TransactionScope class when you want the code
encapsulated in the scope of the instance (it's meant to be used in a using
statement) is to run in a transactional context.

Look at the documentation for the TransactionScope class on how to use
it.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ha******@hotmail.comwrote in message
news:11**********************@e51g2000hsg.googlegr oups.com...
Hi,

I'd really like to use TransactionScope within the Business Layer of
my web application. A book I'm reading makes a note that it should not
be used in a shared web hosting environment because the server may get
re-configured. Can anyone elaborate on this?

Regards,

Chris

May 10 '07 #2
I don't see how the server becoming reconfigured affects the use of
TransactionScope.
Maybe if DTC is disabled... but by that note, virtually everything is
a contender... almost *any* configuration change could potentially
break something... all our code will always be at the mercy of the
services that the OS and runtime provide

Marc

May 10 '07 #3
"Marc Gravell" <ma**********@gmail.comwrote in message
news:11*********************@e65g2000hsc.googlegro ups.com...
> I don't see how the server becoming reconfigured affects the use of
TransactionScope.

Maybe if DTC is disabled... but by that note, virtually everything is
a contender... almost *any* configuration change could potentially
break something... all our code will always be at the mercy of the
services that the OS and runtime provide
Actually, TransactionScope is supposed to work even if DTC is
disabled/uninstalled, as long as you don't do anything that causes
promotion. I've actually got an open bug report on Connect about this (i.e.
it failed for me when DTC wasn't installed), but I've been communicating
with a tester at MSFT who's working on the bug and he can't get it to
reproduce. Indeed, when I tried to repro it myself, I couldn't do it
either - as long as the transaction doesn't need to be promoted, DTC should
not be required.

-cd
May 10 '07 #4
Correct; but the OP didn't specify an RDBMS; only MS SqlServer 2005
supports promotable transactions; prior to this you will get DTC
immediately, without promotions even being an issue.

Marc
May 11 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Mukesh | last post: by
3 posts views Thread by kikapu | last post: by
reply views Thread by RP | last post: by
3 posts views Thread by Aleksey Timonin | last post: by
2 posts views Thread by GaryDean | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.