Esempio n. 1
0
        private Ret <Entity> ExecuteMethod(HttpContext httpContext, MethodInfo method)
        {
            try
            {
                var target = injector.CreateInstance(PaperType);
                try
                {
                    var ret = CreateParameters(httpContext, method);
                    if (ret.IsFault())
                    {
                        return(Ret.Throw(ret));
                    }

                    object[] parameters = ret.Data;
                    method.Invoke(target, parameters);
                }
                finally
                {
                    (target as IDisposable)?.Dispose();
                }

                return(Ret.Ok());
            }
            catch (Exception ex)
            {
                return(Ret.Fail(ex));
            }
        }