/// <summary> /// Ejecuta un servicio de negocio dentro de un ámbito transaccional. /// </summary> /// <param name="pRequest">XML con datos de entrada.</param> /// <param name="serviceConfiguration">configuración del servicio.</param> /// <returns>XML con datos de salida del servicio.</returns> /// <date>2008-04-07T00:00:00</date> /// <author>moviedo</author> public static IServiceContract RunTransactionalProcess(IServiceContract pRequest, ServiceConfiguration serviceConfiguration) { IServiceContract wResult; TransactionScopeHandler wTransactionScopeHandler = CreateTransactionScopeHandler(serviceConfiguration); ServiceError wServiceError = null; // ejecución del servicio. wTransactionScopeHandler.InitScope(); wResult = RunService(pRequest, serviceConfiguration, out wServiceError); if (wServiceError == null) { wTransactionScopeHandler.Complete(); } else { wTransactionScopeHandler.Abort(); } wTransactionScopeHandler.Dispose(); wTransactionScopeHandler = null; return(wResult); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { if (filterContext.Controller.ViewData.ModelState.IsValid && filterContext.HttpContext.Error == null) { if (Behaviour == null) { Behaviour = TransactionalBehaviour.RequiresNew; } if (IsolationLevel == null) { IsolationLevel = IsolationLevel.ReadCommitted; } transactionScopeHandler = new TransactionScopeHandler(Behaviour, IsolationLevel, new TimeSpan(0, 0, 0)); transactionScopeHandler.InitScope(); } base.OnActionExecuting(filterContext); }