O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Use a COM+ Distributed Transaction

Problem

You want to perform multiple operations with different data sources, and you want these operations to either fail or succeed as a unit.

Solution

Derive your class from ServicedComponent, specify the type of transactional behavior you want by adding the Transaction attribute to the class declaration, and add the AutoComplete attribute to all methods.

Discussion

COM+ allows you to create classes that have set transaction requirements. When a client uses a method in a transactional class, a transaction will be started automatically, and committed when the code completes. Coding transactions in this way is easy and transparent. It also allows you to flexibly tie multiple methods together in a single transaction ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required