.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> .NET Framework >> Post New QuestionBookmark and Share Subscribe to Forum

How to implement DTC in .NET?

Posted By: krishana singh     Posted Date: December 08, 2010    Points:2   Category :.NET Framework
How to implement DTC in .NET?

Responses
Author: Faizal             
Posted Date: January 29, 2011     Points: 5   

DTC is implemented using COM+ .
Following are the steps to implement COM + in .NET :-
1."EnterpriseService" namespace has all the classes by which we can implement DTC
in .NET. You have to add reference "EnterpriseService" namespace.DTC is implemented using COM+ .
2. You class must derive from "Serviced Component" object.
3.Then you have to define your class with the transaction attribute
4.After the class level transaction type is defined.Its time to define at the method level
the AutoComplete attribute. Autocomplete attribute says that if no exception is thrown
then mark its part of the transaction as being okay. This helps cut down on the
amount of code required. If the implementation sets AutoComplete to false, or
omits it all together, then we would need to manage the transaction manually. To
manually control the transaction you will need to use the ContextUtil class and its static
members.
Following is small snippet of ContextUtil: -
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();
}
}
Component derived from "ServicedComponent" should be strong named as they
run under COM+.
Once the classes are compiled using the string name.Register the Component in COM+
services using
regsvcs c:\DllPath\TransactionComponent.dll
You can see that the component is registered using the COM+ explorer.

Reference:www.dotnetspider.com



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend