472,791 Members | 977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,791 software developers and data experts.

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 5487
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rick_Kierner | last post by:
I am attempting to use the TransactionScope class to manage my transactions. I am running into an issue. My web server is in an NT work group. My SQL Server is in a domain. When my code...
0
by: ste | last post by:
Please bear with this post.. its abit long winded.. but i thought it was important to describe what i am trying to achieve before i ask the questions (at the bottom) Thanks.....in advance ...
3
by: OUSoonerTaz | last post by:
We are randomly getting this error message on our development and staging machines: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.; at...
6
by: Mukesh | last post by:
Hi, I am new to 2.0 framework. I am trying to use TransactionScope in the following code. I took four lables. Started TransactionScope scope. After setting values to three labels I throw an...
3
by: kikapu | last post by:
Hi to all folks, i am trying to understand the use of System.Transactions in general and TransactionScope particularly. What am i allowed to do in a using statement that wraps a...
3
by: BLUE | last post by:
Only SQL Server 2005 or also DB2, Oracle and MySQL? Thanks, Luigi.
0
by: RP | last post by:
I have a two classes, first named "ModCon" has procedures written for connections and the second named "ModRes" contains functions and procedures that can be reused. For my question it is important...
3
by: Aleksey Timonin | last post by:
Hi guys, I tried to use TransactionScope on to defferent TableAdapters like this: using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required)) {...
2
by: GaryDean | last post by:
When I use transactions with sql server I usually do this... using (TransactionScope scope = new TransactionScope) { using (SqlConnection1 = new SqlConnection . . . . . and this all works...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.