devxlogo

Select the transaction isolation level and timeout in a serviced component

Select the transaction isolation level and timeout in a serviced component

Writing a transactional COM+ component with VB.NET is as simple as applying the Transaction attribute to a class that inherits from System.EnterpriseServices.ServicedComponent:

Imports System.EnterpriseServices< Transaction()> Public Class BankTransfer    Inherits ServicedComponent    ' ...End Class

If you don’t pass any argument to the attribute’s constructor, the class is marked as requiring a transaction. You can explicitly set the transaction behavior by passing a TransactionOption enumerated value, which can be Disabled, NotSupported, Supported, Required, and RequiresNew:

< Transaction( TransactionOption.RequiresNew )>

Even more interesting, you can set the isolation level for the transaction being used, by setting the Isolation property, which in turn can take a TransactionIsolationLevel enumerated value (Any, ReadUncommitted, ReadCommitted, RepeatableRead, or Serializable), and even set the transaction timeout by setting the Timeout property, if you want to override the global timeout value:

< Transaction( TransactionOption.RequiresNew, _    Isolation:=TransactionIsolationLevel.Repeatable, Timeout:=10 )>

See also  5 Ways to Improve Customer Experience
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist