Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
From the author of

#5 Configurable Isolation Levels

In previous versions of Component Services, if you used distributed transactions, the isolation level was always set to Serialized. Basically, this meant that if your component accessed any resource (say a database row) it would ensure that it was exclusively locked for the life of the transaction. This was the case even if the row was simply read and not updated. Obviously, this is the safest choice because it ensures that the component will always see the data in a consistent state. However, this has the effect of decreasing concurrency because other clients wishing to read or update the row will encounter a lock. As a result, in many situations it may be better to allow the component to operate at a lower isolation level.

To enable this feature, the Transactions tab of the component's properties dialog box includes a drop-down (shown in Figure 4), which is enabled when the transaction level is set to Supported or higher, and which defaults to Serialized, but also includes Repeatable Read, Read Committed, Read Uncommitted, (in decreasing order of isolation), and Any. For example, by changing the component to Read Committed (the default for SQL Server), you ensure that your component will only be able to read rows committed to the database, but it may be the case that data will have changed by other clients when subsequently read. This increases concurrency by allowing other clients to work with the data simultaneously, but it decreases consistency. The design and requirements of your application should determine which setting you choose.

Figure 4 The component's properties dialog box now supports configurable isolation levels in the Transactions tab.

It should be noted that changing the isolation level from Serialized or Any on a component requires that all components called from that component have their isolation levels set to the same level or a lower level.

  • + Share This
  • 🔖 Save To Your Account