I am gonna build a service using 3-tier architecture and I am really worried about how to handle operations in a transacted way.
I know I have 2 options: IDbTransaction
and TransactionScope
... but I am not really decided for which one to go, although I did a lot of research.
I would go for TransactionScope but I don't want to involve DTC... plus I need support for SQLServer2005 and Oracle. (I am aware that I need to have only one connection opened at a time)
I would like to see good examples/patterns of their usage for both cases... Good links would do just fine.
Something like how a BL class and DAL class would look like... but also how transaction/connections are created and carried between them.
Edit1: I am looking for somekind of implementation of this (but for both options):
using(var scope = new TransactionScope())
{
// transactional methods
datalayer.InsertFoo();
datalayer.InsertBar();
scope.Complete();
}
Edit2:
Since Denis offered me a very good alternative... I still wait for somebody to show me a good example of a model with interaction between business layer and data layer using 'TransactionScope
'
Thank you.