Home > Microsoft .Net Development Tips > ASP.NET Development > Automatic transaction using ASP.NET
Win Development Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ASP.NET DEVELOPMENT

Automatic transaction using ASP.NET


Kamran Shakil
03.28.2003
Rating: -4.50- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Let other users know how useful this tip is by rating it below. Got a tip or code of your own you'd like to share? Submit it here.


Two or more .NET Framework objects can participate in the same transaction. One or more .NET Framework objects can participate in the same transaction as one or more COM+ objects. All objects must be hosted in Microsoft Windows 2000 Component Services so as to receive services such as transaction processing.

There are several considerations you must address in designing transactions that span COM+ and .NET Framework objects. For example, in order for a .NET Framework object to participate in an automatic transaction, the .NET Framework class must be registered with Window 2000 Component Services. However, not all transactions are automatic. The activities you perform when programming transactions depend on the transaction model you choose.

Microsoft Transaction Server (MTS), COM+ and the Common Language Runtime (CLR) support the same automatic, distributed transaction model.

Once an ASP.NET page, WebMethod or .NET Framework class is marked to participate in a transaction, it will automatically execute within the scope of a transaction. You can control an object's transactional behavior by setting a transaction attribute value on the page, WebMethod or class. The attribute value, in turn, determines the transactional behavior of the instantiated object.

Thus, based on the declared attribute value, an object will automatically participate in an existing or ongoing transaction, be the root of a new transaction, or never participate in a transaction at all. The ASP.NET framework supports automatic transactions on Windows 2000. By inserting a transaction directive into your ASP.NET page, you can instruct the page to participate in an existing transaction, begin a new transaction or never participate in a transaction.

The table below lists and describes the transaction directives available in ASP.NET.

Directive Description
NotSupported This value indicates that the page does not run within the scope of transactions. When a request is processed, its object context is created without a transaction, regardless of whether there is a transaction active.
Supported The page will run in the context of an existing transaction, if one exists. If not, it will run without a transaction.
Required The page requires a transaction. It will run in the context of an existing transaction, if one exists. If not, it will start one.
RequiresNew The page requires a transaction and a new transaction will be started for each request.

You can indicate the level of transaction support on a page by placing the directive in your code. For example, you can ensure that the page activities always execute in the scope of a transaction by inserting the following directive:

<%@ Page Transaction="Required" %>

The default transaction state is None, which indicates that the transaction context will be ignored by the ASP.NET framework. There is no explicit directive for this value; in other words, you cannot add page Transaction="None" to your page. Instead, simply omit the transaction directive to apply the default value.


Source: DotNetExtreme.com

Rate this Tip
To rate tips, you must be a member of SearchWinDevelopment.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
ASP.NET Development
How to use jQuery to solve Javascript browser compatibility problems
How to write an out-of-browser Silverlight 3 application in 3 steps
Silverlight 3 beta SDK download lets developers try new RIA features
Visual Studio's IntelliSense for jQuery doesn't autocomplete correctly
Dundas Map for .NET kicks up geographic visualization
Return to CodePlex: Into the Sandcastle…
VBScript Tutorial
Use PHP with Visual Studio to create Web sites
Visual Studio Team System Add-ins: Conchango Scrum for Team System and Scrum Dashboard
Visual Studio 2008 and .NET Framework 3.5 SP1 introduces ADO .NET Entity Designer

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Database Programming Solutions - .NET XML, Visual Studio LINQ, ORM .NET
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts