|
Speed Transaction Processing in .NET 2.0
Improve transaction performance easily with the second-generation .NET Framework.
by Thiru Thangarathinam
March 14, 2005
Technology Toolbox: C#, .NET Framework 2.0, SQL Server 2005
Version 1.x of the .NET Framework gave developers some capable tools for controlling transactions, but the .NET Framework 2.0 expands the original capabilities significantly. Version 2 builds on the foundation of .NET 1.x’s transaction features, providing new classes and methods that not only provide better performance, but are also easy to use. I’ll show you how to take advantage of some of these features, which will translate to better-performing transaction code in your applications. I’ll also walk you through some of the different scenarios in which you can take advantage of the new transaction features.
Let’s start by looking at System.Transactions. .NET Framework 1.x provides support for transactions mainly through the System.EnterpriseServices namespace and by the System.Data.IDbTransaction interface, implemented by the different data providers. If you’ve used these models, you’ll agree that both have some disadvantages; the former forces inheritance from ServicedComponent, the latter offers support only for local transactions in a specific database, and together they don’t provide a complete programming model.
Now, with the release of the .NET Framework 2.0, the limitations are gone and transactions are available through a new and simple-to-use programming model, offering an increasing number of possibilities that can make your work simpler, safer, and even faster. System.Transactions is an object model with a handful of classes, interfaces, and enumerations. The key classes in this namespace include CommittableTransaction, Transaction, TransactionScope, Transaction, and TransactionOptions.
Some of the important features offered by System.Transactions include an easy-to-use programming model, support for transactional code blocks using the new TransactionScope object, a super-fast lightweight transaction manager for transactions that involve a single database, and automatic promotion from lightweight to distributed transactions on an as-needed basis.
Back to top
|