public TransactionalUnitOfWorkWindsorScope(IWindsorContainer container)
 {
     _transactionScopeWeCreatedAndOwn = new TransactionScope();
     try
     {
         _unitOfWork = new UnitOfWork(container.Resolve<ISingleContextUseGuard>());
         _unitOfWork.AddParticipants(container.ResolveAll<IUnitOfWorkParticipant>());
         Transaction.Current.EnlistVolatile(this, EnlistmentOptions.None);
     }
     catch(Exception)
     {
         _transactionScopeWeCreatedAndOwn.Dispose();//Under no circumstances leave transactions scopes hanging around unmanaged!
         throw;
     }                
 }
Exemplo n.º 2
0
 public TransactionalUnitOfWorkWindsorScope(IWindsorContainer container)
 {
     _transactionScopeWeCreatedAndOwn = new TransactionScope();
     try
     {
         _unitOfWork = new UnitOfWork(container.Resolve <ISingleContextUseGuard>());
         _unitOfWork.AddParticipants(container.ResolveAll <IUnitOfWorkParticipant>());
         Transaction.Current.EnlistVolatile(this, EnlistmentOptions.None);
     }
     catch (Exception)
     {
         _transactionScopeWeCreatedAndOwn.Dispose();//Under no circumstances leave transactions scopes hanging around unmanaged!
         throw;
     }
 }