How can I use the System.Transactions transaction in System.EnterpriseServices?
This can be done using the BYOT (Bring Your Own Transaction) functionality. A
transaction is created with System.Transactions and
then inherited by a service component.� Context information for this service
component is obtained, and then the transaction is rolled back.
static void Main(string[] args)
{
System.EnterpriseServices.ITransaction estx = null;
try
{
using (TransactionScope scope = new TransactionScope ())
{
// Convert the transaction object to make it compatible
// with EnterpriseService transactions (required for ADO.NET)
//
estx = (System.EnterpriseServices.ITransaction) OletxInterop.GetTransactionNative(Transaction.Current);
SvcComp sc = (SvcComp) BYOT.CreateWithTransaction(estx, typeof(SvcComp));
sc.DisplayTransactionState();
}
}
}
...
C#
The following sample demonstrates how you can create a transaction using System.Transactions and subsequently create
a serviced component with the same transaction.
No Source or Sample to display.
Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright � 2004 Microsoft Corporation. All rights reserved.
|