473,386 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 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 5531
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.