Solved

is transaction-support in asp.net overkill?

Posted on 2003-11-12
7
613 Views
Last Modified: 2013-11-25
Hi,

does anybody have experience with the 'transaction' keyword of the @page directive in asp.net?

<% @page ... transaction="Requires | Supported | RequiresNew | ..." %>

I will give the points not for a solution but for a 'best practices' of how and when I should use
Microsoft transaction server (MTS) as a transaction layer. Especially the influence on performance
and reliability would be very interesting.

As I am in the middle of a time-critical project I appreciate any quick help :-)

Thx in advance,
foobar
0
Comment
Question by:foobar43
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 4

Expert Comment

by:NetPointer
ID: 9733538
This link will explain you about when to use com+ services...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet04232002.asp
it also shows u how to use them


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/entserv.asp
this will show u how it works internally and why its over kill..


This is excellent resource about COM+Services...
http://www.ondotnet.com/pub/a/dotnet/excerpt/com_dotnet_ch10/index.html?page=1

HTH
NetPointer
0
 
LVL 1

Author Comment

by:foobar43
ID: 9734801
NetPointer,

great, in-deep information even though the information itself is another overkill :-)

Definitely I will take the time after the project to read all of it, but apparently I would appreciate
some real-life experience with COM+ transactions in the scope of ASP.NET pages.

I expect them to be a great way to keep all the database operations within the
page in one great transaction that would roll back in the case of error / exception.

It this true or would someone suggest to use local transactions instead?

(1)
  SqlConnection conn = ....
  SqlTransaction trans = conn.BeginTransaction();

versus

(2)
  <%@ page transaction="RequiresNew" %>

Especially I am interested in the performance impact and the reliability of the
MTS service itself. We all know M$ products from time to time have their
little problems...

thx @lot
foobar
0
 
LVL 4

Expert Comment

by:NetPointer
ID: 9735825
I will prefer the MTS transactions in case there are multiple database and connections involved....for single connection/database i will prefer the first method...

Regards,
NetPointer
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 1

Author Comment

by:foobar43
ID: 9735906
makes sense...

just one thing without wanting to stretch your patience too far:

I have a couple of business objects that encapsulate the database data like

Order
Customer
Product
Size

in order to keep the interface to these objects pure and clean I implicitly get a pooled
SqlConnection inside the business object method

example:

public Product FindByName(string name)
{
  SqlConnection conn = Database.GetConnection(); // get a pooled connection
 
  <blah>
  ....
  </blah>

}

In order to use local transactions I would probably need

public Product FindByName(SqlTransaction trans, string name)
{
  SqlConnection = trans.Connection;
 
  <blah>
}

I think having system-specific stuff as part of the business object
methods would be really a loss of purity. Automatic transactions with COM+
would prevent that and even simplify programming.

Do you think the possible loss of performance is significant / worth it?

Is pooling connections inside the methods really crappy or can you live with it?

mucho gracias
foobar
0
 
LVL 1

Author Comment

by:foobar43
ID: 9735911
little typo:

public Product FindByName(string name)
 
->

public static Product FindByName(string name)
0
 
LVL 4

Accepted Solution

by:
NetPointer earned 500 total points
ID: 9736335
first, I would check that whats the necessicity of transaction for GETTING data....

Usually we use transactions to maintain data integrity...so in that case, u will use it usually while u Insert/update data in database.

Second, like when u r updating more then one tables, I would take an approach that I just call stored proc passing it to necessary paras...and then in that stored proc, i will use sql servers begintran committran and in between i will update multiple tables.

>I think having system-specific stuff as part of the business object
>methods would be really a loss of purity. Automatic transactions with COM+
>would prevent that and even simplify programming.

I agree with this...but COM+ is using interop which significantly adds overheads to your application which I would avoid till it is strictly desired...

instead you can use a seperate Data access layer, which is invoked by your business layer..If you got some time, I recommended Microsoft data access block to study..

HTH,
NetPointer
0
 
LVL 1

Author Comment

by:foobar43
ID: 9736353
hey, thanks a lot for your help!!

for now I got enough information to put a decision on the current project.
I will go for a mixture of local and stored procedure transactions for the
benefit of speed (plus one service less needed to run my app -
namely MS-DTC).

despite the points I got some nice information for you too which I found
previously. very nice article on performance and .net-transactions in web-apps:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/psent.asp

you are absolutely right, the com+ interop overhead is just _too_ much...

thanks and have a nice day

regards
foobar
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question