private CachedFunctionInfo AnalyzeFunctionControllerType(Type controllerType)
        {
            var method = FindOnCallMethod(controllerType);

            if (method == null)
            {
                return(null);
            }

            var path = ResolveRoute(controllerType);

            if (!FunctionRouteParser.IsValidRpcRoute(path, rpcServerConfiguration))
            {
                return(null);
            }

            var name = FunctionRouteParser.GetFunctionName(path, rpcServerConfiguration);

            if (!FunctionRouteParser.IsValidFunctionName(name))
            {
                return(null);
            }

            var info = new CachedFunctionInfo
            {
                CallMethod            = method,
                Name                  = name,
                Path                  = path,
                IsCallMethodAsync     = IsMethodAsync(method),
                RequiresAuthorization = FunctionRequiresAuthorization(method),
            };

            return(info);
        }
Beispiel #2
0
 private void Prepare()
 {
     RpcService = HttpContext.Items["rpcService"] as RpcService ??
                  throw new RpcServerException("RPC service not found");
     functionInfo = HttpContext.Items["functionInfo"] as CachedFunctionInfo ??
                    throw new RpcServerException("No cached function info");
     FunctionName = functionInfo.Name;
 }