예제 #1
0
        public object Get(NativeHostAction request)
        {
            if (string.IsNullOrEmpty(request.Action))
            {
                throw HttpError.NotFound("Function Not Found");
            }
            Type   nativeHostType = typeof(NativeHost);
            object nativeHost     = nativeHostType.CreateInstance <NativeHost>();
            //Upper case first character.
            string     methodName = request.Action.First().ToString().ToUpper() + String.Join("", request.Action.Skip(1));
            MethodInfo methodInfo = nativeHostType.GetMethod(methodName);

            if (methodInfo == null)
            {
                throw new HttpError(HttpStatusCode.NotFound, "Function Not Found");
            }
            methodInfo.Invoke(nativeHost, null);
            return(null);
        }
예제 #2
0
 public object Get(NativeHostAction request)
 {
     if (string.IsNullOrEmpty(request.Action))
     {
         throw HttpError.NotFound("Function Not Found");
     }
     Type nativeHostType = typeof(NativeHost);
     object nativeHost = nativeHostType.CreateInstance<NativeHost>();
     //Upper case first character.
     string methodName = request.Action.First().ToString().ToUpper() + String.Join("", request.Action.Skip(1));
     MethodInfo methodInfo = nativeHostType.GetMethod(methodName);
     if (methodInfo == null)
     {
         throw new HttpError(HttpStatusCode.NotFound, "Function Not Found");
     }
     methodInfo.Invoke(nativeHost, null);
     return null;
 }