How to implement DTC in .NET

Q

How to implement DTC in .NET ?

✍: Guest

A

DTC is implemented using COM+.
Following are the steps to implement COM + in .NET :-
ã gEnterpriseServiceh namespace has all the classes by which we can implement DTC in .NET. You have to add reference gEnterpriseServiceh namespace.



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 gServicedComponenth 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.

2007-10-22, 5571👍, 0💬