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
Import Columns of Data into Data Table for Data Grid View in C# and WPF Need help with a project in C# / WPF. Trying to read a csv file or text file with columns of data that wi

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

What does a break statement do in the switch statement? The switch statement is a selection control statement that is used to handle many choices and transfer control to the ca

What is a host process? A host process is an implementable program that hosts a workflow. It might be a Windows Forms application, a Web application, or a Web service applicati

What is a Link? At the lowest level, a network can have of two or more computers directly linked by some physical medium such as coaxial cable or optical fiber. Such a physical

I need Kinect Developer c++ We are creating a fitting room with Kinnect and I need some questions answered like how to detect if a person turns around, how to make the clothing

What is CMMI? This is a collection of instructions an organization can follow with the purpose to gain the better control over its software development process. According to

What are different transaction levels in SQL SERVER? The Transaction Isolation level decides how is the one process isolated from theother process. Using the transaction levels

Program of Nested Loop - C# Program I am a learner of C# language and i am struggling with the Loops in c#. Can you have any code examples for this.

Project Description: We are seeking experienced .NET developers (possibly certified) to work with us on several future projects. You will have to pass a simple test to be consid