public void OnActionExecuting(ActionExecutingContext context) { var descriptor = context.ActionDescriptor as ControllerActionDescriptor; //check if transactions isolation levels were specified for the request and if so, set them in appropriate Unit of Work var isolationLevelAttributes = descriptor.MethodInfo.GetCustomAttributes <TransactionIsolationLevelAttribute>(true); var globalIsolationLevelAttribute = isolationLevelAttributes?.SingleOrDefault(x => string.IsNullOrEmpty(x.UnitOfWorkKey)); //set isolation level for all UoWs if (globalIsolationLevelAttribute != null) { foreach (var uow in _uowPool.GetAll()) { uow.SetIsolationLevel(globalIsolationLevelAttribute.Level); } } //override the previously set isolation level for specific UoWs if (isolationLevelAttributes != null) { foreach (var attr in isolationLevelAttributes) { var uow = _uowPool.Get(attr.UnitOfWorkKey); uow.SetIsolationLevel(attr.Level); } } }
public ReleasesUoW(IUnitOfWorkPool uowPool) { _uow = uowPool.Get(KEY); }
public IssuesUow(IUnitOfWorkPool uowPool) { _uow = uowPool.Get(KEY); }