Hi,
I wrote the following code
using (var transaction = TransactionUtils.CreateTransactionScope())
{
var uow = new UnitOfWork2();
uow.Commit(Adapter);
var uow1 = new UnitOfWork2();
uow1.Commit(Adapter);
Adapter.Commit();
}
When the code is executed following error will occur
Connection is already part of a local or a distributed transaction
Adapter's lifetime is per request.
I noticed when I use StartTransaction instead of transactionscope the code will work.
Adapter.StartTransaction(IsolationLevel.ReadCommitted, "delete");
var uow = new UnitOfWork2();
uow.Commit(Adapter);
var uow1 = new UnitOfWork2();
uow1.Commit(Adapter);
Adapter.Commit();
Could you please explain why is this happening ?