Hi there, did you miss me? =)
I’ve got several good news about current DataObjects.Net’s development phase.
First of all, we started to implement nested transactions. It might had required to change the current transaction API but we managed to keep the compatibility with the previous version of the API.
In DO 4.0.5 we wrote:
using (var tx = Transaction.Open()) { // your code here tx.Complete(); }
In DO 4.1 this code means exactly the same thing: I need a transaction, please, open one if it is absent; otherwise do nothing.
And this is how we are going to tell that a new transaction is definitely required:
using (var tx = Transaction.Open(TransactionOpenMode.New)) { // your code here tx.Complete(); }
Note new TransactionOpenMode enum. It is introduced in DO 4.1 and has 2 options: Auto and New. Auto goes for default behavior (I don’t care which transaction I need, just provide me with one) and New goes for new (or nested one, if an outer transaction is already opened).
Rolling back nested transaction does not make any harm to outer transaction whereas commit of outer transaction automatically commits all nested transactions.
Nested transaction are implemented for SQL-based storages with the help of Savepoint feature. It is supported by most SQL servers such as MS SQL Server, Oracle, PostgreSQL, etc. Moreover, Savepoint notion is included in SQL standard.
P.S. Please remember that this is preliminary API that might be changed in final version.