Ejemplo n.º 1
0
        /// <summary>
        /// 注册有返回值RPC方法
        /// </summary>

        public static void RegisterValueMethod(object obj, MethodInfo methodInfo)
        {
            if (obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }

            if (methodInfo == null)
            {
                throw new ArgumentNullException(nameof(methodInfo));
            }

            var returnValueMethod = DelegateFactory.CreateReturnValueMethod <Func <object[], object> >(obj, methodInfo);

            RegisterMethod(methodInfo, returnValueMethod);
        }
Ejemplo n.º 2
0
        public static Func <object[], object> RegisterValueMethod(string id, object obj, MethodInfo methodInfo)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentException(nameof(id));
            }

            if (obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }

            if (methodInfo == null)
            {
                throw new ArgumentNullException(nameof(methodInfo));
            }

            var returnValueMethod = DelegateFactory.CreateReturnValueMethod <Func <object[], object> >(obj, methodInfo);

            RegisterMethod(id, returnValueMethod);
            return(returnValueMethod);
        }