Hi all...
Just to notify what I'm doing now. I'm studing and reading the posibility of change/improve our transaction support (was wrote at .net1.1 time)
Our transaction support is *explicit*, it mean we are using for example IDbTransaction to delimit transaction "scope". My idea is use th *implicit* support proposed by Ado.Net2.0: System.Transactions.
For ilustrate my draw idea, I wrote this tentative code:
using(ITransaction tx1 = s.BeginTransaction())
{
using(ITransaction tx2 s.BeginTransaction())
{
//Transactional work here
tx2.Commit();
}
//Transactional work here
tx1.Commit();
}
This mean that tx2 will be enlisted onto tx1, and tx1 depends of the success of tx2. Equivalent to this TransactionScope example:
using(TransactionScope tx1 = new TransactionScope())
{
using(TransactionScope tx2 = new TransactionScope(Required))
{
//Transactional work here
tx2.Complete();
}
//Transactional work here
tx1.Complete();
}
Other escenario could be this:
using(ITransaction tx1 = s.BeginTransaction())
{
using(ITransaction tx2 s.BeginTransaction(Scope.RequiresNew))
{
//Transactional work here
tx2.Commit();
}
//Transactional work here
tx1.Commit();
}
This mean that the inner transaction (tx2) requires another transaction for it work (maybe for business-logging at domain level), and it success/failed doesn't it matter to tx1.
Some considerations:
- The main idea is support the modes: Required, RequiresNew, Suppress[?].
- Deprecate our tx-support, or just join with it? If we support both, it mean support: IDbTransaction and System.Transactions, could be painful to implement and maintain and I think that we could just use System.Transactions without performance lost.
- To much easy to jump at DTC support (it come for free).
I need feedback, ideas, comments, advantajes, disadvantages, anything that you could say.
This is a good start for know System.Transactions:
http://msdn2.microsoft.com/en-us/library/ms973865.aspx
Best regards.
--
Dario Quintana
http://darioquintana.com.ar