/// <summary>
        ///
        /// </summary>
        /// <param name="req"></param>
        /// <param name="operationDesc"></param>
        /// <returns></returns>
        protected virtual IServiceResponse OnExecute(IServiceRequest req, IOperationDescriptor operationDesc)
        {
            var resp = new ServiceResponse();
            //得到领域服务元数据
            var serviceDesc        = operationDesc.ServiceDescriptor;
            var svrResolvedContext = new ServiceResolvedContext(serviceDesc, req, resp);

            ServiceContext.Current = new ServiceContext {
                Request = req, Response = resp
            };

            try
            {
                ListenManager.OnServiceDescriptorFound(svrResolvedContext);
                if (svrResolvedContext.Cancelled)
                {
                    return(resp);
                }

                svrResolvedContext.OperationDescriptor = operationDesc;
                ListenManager.OnOperationDescriptorFound(svrResolvedContext);
                if (svrResolvedContext.Cancelled)
                {
                    return(resp);
                }
            }
            catch (Exception ex)
            {
                resp.AddException(ex);
                return(resp);
            }

            object service = null;

            try
            {
                service = ServiceLocator(serviceDesc.Id);
            }
            catch (Exception ex)
            {
                resp.AddException(new ServiceDispatcherException(ServiceDispatcherExceptionCode.CreateServiceException, ex)
                {
                    ServiceName   = req.ServiceName,
                    OperationName = req.OperationName
                });
                return(resp);
            }

            svrResolvedContext.Service = service;
            ListenManager.OnServiceResolved(svrResolvedContext);
            if (svrResolvedContext.Cancelled)
            {
                return(resp);
            }

            try
            {
                req = PopulateModelBinding(operationDesc, req, resp);
            }
            catch (Exception ex)
            {
                resp.AddException(new ServiceDispatcherException(ServiceDispatcherExceptionCode.ParameterBindException, ex)
                {
                    ServiceName   = req.ServiceName,
                    OperationName = req.OperationName
                });
                return(resp);
            }

            try
            {
                if (!ValidateParamters(operationDesc, req, resp))
                {
                    resp.AddException(new ServiceDispatcherException(ServiceDispatcherExceptionCode.ModelValidationException)
                    {
                        ServiceName   = req.ServiceName,
                        OperationName = req.OperationName
                    });
                    return(resp);
                }
            }
            catch (Exception ex)
            {
                resp.AddException(new ServiceDispatcherException(ServiceDispatcherExceptionCode.ModelValidationException, ex)
                {
                    ServiceName   = req.ServiceName,
                    OperationName = req.OperationName
                });
                return(resp);
            }

            //创建操作上下文对象
            var ctx = new OperationExecutedContext(req, operationDesc)
            {
                Response = resp
            };

            try
            {
                //执行前置过滤器
                OnBeforeAction(service, ctx);

                //如果过滤器进行了必要的拦截则返回
                if ((ctx as IOperationExecutingContext).Cancelled)
                {
                    return(resp);
                }

                //调用领域服务方法
                resp.Result = operationDesc.Invoke(service, ctx.Arguments.Values.ToArray());

                ctx.Service = service;

                //执行后置过滤器
                OnAfterAction(ctx);
                resp.Success = true;
            }
            catch (Exception ex)
            {
                resp.AddException(ex);
            }

            return(resp);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="req"></param>
        /// <param name="operationDesc"></param>
        /// <returns></returns>
        protected virtual IServiceResponse OnExecute(IServiceRequest req, IOperationDescriptor operationDesc)
        {
            var resp = new ServiceResponse();
            //得到领域服务元数据
            var serviceDesc = operationDesc.ServiceDescriptor;
            var svrResolvedContext = new ServiceResolvedContext(serviceDesc, req, resp);
            ServiceContext.Current = new ServiceContext { Request = req, Response = resp };

            try
            {
                ListenManager.OnServiceDescriptorFound(svrResolvedContext);
                if (svrResolvedContext.Cancelled)
                    return resp;

                svrResolvedContext.OperationDescriptor = operationDesc;
                ListenManager.OnOperationDescriptorFound(svrResolvedContext);
                if (svrResolvedContext.Cancelled)
                    return resp;
            }
            catch (Exception ex)
            {
                resp.AddException(ex);
                return resp;
            }

            object service = null;
            try
            {
                service = ServiceLocator(serviceDesc.Id);
            }
            catch (Exception ex)
            {
                resp.AddException(new ServiceDispatcherException(ServiceDispatcherExceptionCode.CreateServiceException, ex)
                {
                    ServiceName = req.ServiceName,
                    OperationName = req.OperationName
                });
                return resp;
            }

            svrResolvedContext.Service = service;
            ListenManager.OnServiceResolved(svrResolvedContext);
            if (svrResolvedContext.Cancelled)
                return resp;

            try
            {
                req = PopulateModelBinding(operationDesc, req, resp);
            }
            catch (Exception ex)
            {
                resp.AddException(new ServiceDispatcherException(ServiceDispatcherExceptionCode.ParameterBindException, ex)
                {
                    ServiceName = req.ServiceName,
                    OperationName = req.OperationName
                });
                return resp;
            }

            try
            {
                if (!ValidateParamters(operationDesc, req, resp))
                {
                    resp.AddException(new ServiceDispatcherException(ServiceDispatcherExceptionCode.ModelValidationException)
                    {
                        ServiceName = req.ServiceName,
                        OperationName = req.OperationName
                    });
                    return resp;
                }
            }
            catch (Exception ex)
            {
                resp.AddException(new ServiceDispatcherException(ServiceDispatcherExceptionCode.ModelValidationException, ex)
                {
                    ServiceName = req.ServiceName,
                    OperationName = req.OperationName
                });
                return resp;
            }

            //创建操作上下文对象
            var ctx = new OperationExecutedContext(req, operationDesc) { Response = resp };

            try
            {
                //执行前置过滤器
                OnBeforeAction(service, ctx);

                //如果过滤器进行了必要的拦截则返回
                if ((ctx as IOperationExecutingContext).Cancelled)
                    return resp;

                //调用领域服务方法
                resp.Result = operationDesc.Invoke(service, ctx.Arguments.Values.ToArray());

                ctx.Service = service;

                //执行后置过滤器
                OnAfterAction(ctx);
                resp.Success = true;
            }
            catch (Exception ex)
            {
                resp.AddException(ex);
            }

            return resp;
        }