コード例 #1
0
        /// <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);
        }
コード例 #2
0
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            if (filterContext.Controller.ViewData.ModelState.IsValid && filterContext.HttpContext.Error == null && transactionScopeHandler != null)
            {
                transactionScopeHandler.Complete();
            }
            else
            {
                transactionScopeHandler.Abort();
            }

            base.OnActionExecuted(filterContext);
        }