Home   |   QuickStart Welcome   |   ASP.NET   |   Web Services   |   How Do I...?   
  |   I want my samples in...      

How Do I...? Common Tasks QuickStart Tutorial

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;

                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));



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.