Implement dtc in .net, DOT NET Programming

How to implement DTC in .NET

DTC is implemented using the COM+.

Following are some of the steps to implement COM + in .NET:-

1) The "EnterpriseService" namespace has all the classes by which we can implement the DTC in .NET. You have to add reference "EnterpriseService" namespace.

692_implement DTC in .NET.png

2) You must derive your class from "Serviced Component" object.

3) After that you have to define your class with the transaction attribute 

      [ Transaction(TransactionOption.RequiresNew) ]

4) When the class level transaction type is defined.  Now its  time to define at the method level the AutoComplete attribute. Autocomplete attribute explains that if no exception is thrown then mark its part of the transaction as okay. This helps to cut down on the amount of code required. If the implementation sets AutoComplete to false, or omits it altogether, then we would require to manage the transaction manually. For manually control the transaction you will require to use the ContextUtil class & its static members.

 

public void SampleFunction()

{

try

{

// Do something to a database

// ...

// Everything okay so far Commit the transaction

 ContextUtil.SetComplete();

}

catch(Exception)

 {

// Something went wrong Abort and Rollback the Transaction.

 ContextUtil.SetAbort();

}

}

 

5)The Component which is  derived from "ServicedComponent" must  be strong named as they run under COM+.

6)Once the classes are compiled using the string name.Register the Component in COM+ services using

 regsvcs c:\DllPath\TransactionComponent.dll

7)The component is registered by using the COM+ explorer.

Posted Date: 9/21/2012 7:29:39 AM | Location : United States







Related Discussions:- Implement dtc in .net, Assignment Help, Ask Question on Implement dtc in .net, Get Answer, Expert's Help, Implement dtc in .net Discussions

Write discussion on Implement dtc in .net
Your posts are moderated
Related Questions
This assignment is based on lectures, tutorials, computer labs and research work. 1. Background During the lectures and tutorials on business process modeling and business

What is XSLT? The XSLT is a rule based language used to transform XML documents into other file formats. The XSLT are nothing but generic transformation rules which can be appl


What is denormalization? The Denormalization is the process of putting one fact in numerous places (i.e. the vice-versa of normalization). Only one valid reason exists for deno

Explain Forms authentication in detail. In the old ASP if you were said to create a login page and do authentication you have to do lot of custom coding. But now in ASP.NET tha

I have a site that's already fully developed, and need to solve some small issue (Text editor posting error, and a Server error caused by some Nhibernate code.) Server Error in

Mention the name of the directory where it is essential to locate the proxy file to use a Web service. The proxy file must be kept in the /bin directory. This directory is situ

Explain the XML elements. The elements are the central units of an XML document that define and identify data. The elements are represented by the tags. You can also make your

What is garbage collection? Explain the difference among garbage collections in .NET 4.0 and earlier versions. Garbage collection stops memory leaks during execution of pro

Web Service based application: Aims and Objectives Classics Online is a Web-based book and music retailer specialising in pre-1980s hardback