Exemple #1
0
        /// <summary>
        /// 拦截方法的调用
        /// </summary>
        /// <param name="target">接口的实例</param>
        /// <param name="method">接口的方法</param>
        /// <param name="parameters">接口的参数集合</param>
        /// <returns></returns>
        public virtual object Intercept(object target, MethodInfo method, object[] parameters)
        {
            var apiActionDescripter = this.GetApiActionDescriptor(method, parameters);
            var apiTask             = ApiTask.CreateInstance(this.ApiConfig, apiActionDescripter);

            return(apiTask);
        }
        /// <summary>
        /// 拦截方法的调用
        /// </summary>
        /// <param name="target">接口的实例</param>
        /// <param name="method">接口的方法</param>
        /// <param name="parameters">接口的参数集合</param>
        /// <returns></returns>
        public virtual object Intercept(object target, MethodInfo method, object[] parameters)
        {
            var apiActionDescripter = this.GetApiActionDescriptor(method, parameters);
            var apiTask             = ApiTask.CreateInstance(this.ApiConfig, apiActionDescripter);

            if (apiActionDescripter.Return.IsITaskDefinition == true)
            {
                return(apiTask);
            }
            else
            {
                return(apiTask.InvokeAsync());
            }
        }