Transactions in SnapDAL

No data access api would be complete without a discussion of how it supports transactions. In the beginning, SnapDAL had some fairly simple goals and philosophies in regards to transactions. These are still supported. They are:

These goals mean that there will not be an attempt by SnapDAL to provide a COM+ style automatic enlistment procedure, even though there are good arguments for doing so. Currently there are one ways of sharing a transaction between calls: pass a transaction with each method call. If an application originates the call, it can originate a transaction. The application code can accept a transaction, either by class properties or by overloaded method calls. Every DataFactory method has overloads that accept transactions. Call this the manual way. It's actually easier than you think to get right and because it's explicit, it's very easy to understand and troubleshoot. It's kind of ugly too, and does muddy the encapsulation that you worked so hard to build into your OO designs.

Currently under development is a two-phase commit mechanism that will be provide by the DataFactory's BeginTransaction mechanism. Any caller can call BeginTransaction, then commit or rollback, but only the first caller would actually be able to commit finally. Details to follow.