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; } }
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; } }