Example #1
0
        /// <summary>通过传入参数字典快速调用静态方法</summary>
        /// <typeparam name="TTarget"></typeparam>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="name"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public static TResult InvokeByDictionaryParameter <TTarget, TResult>(String name, IDictionary parameters)
        {
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            MethodInfoX mix = Create(typeof(TTarget), name);

            if (mix == null)
            {
                throw new XException("类{0}中无法找到{1}方法!", typeof(TTarget).Name, name);
            }

            return((TResult)mix.InvokeByDictionaryParameter(null, parameters));
        }
Example #2
0
        /// <summary>通过传入参数字典快速调用方法</summary>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="target"></param>
        /// <param name="name"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public static TResult InvokeByDictionaryParameter <TResult>(Object target, String name, IDictionary parameters)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            MethodInfoX mix = Create(target.GetType(), name);

            if (mix == null)
            {
                throw new XException("类{0}中无法找到{1}方法!", target.GetType().Name, name);
            }

            return((TResult)mix.InvokeByDictionaryParameter(target, parameters));
        }