Exemplo n.º 1
0
 public RpcMethod(Type type, RpcRoute route, MethodInfo methodInfo)
 {
     this.type              = type;
     this.Route             = route;
     this.methodInfo        = methodInfo;
     this.parameterInfoList = methodInfo.GetParameters();
 }
        public void RegisterClassToRpcRoute <T>(string routeName = null)
        {
            Type     type  = typeof(T);
            RpcRoute route = this.Routes.GetByName(routeName);

            if (route == null)
            {
                route = new RpcRoute(routeName);
                this.Routes.Add(route);
            }

            bool uniqueClass = route.AddClass <T>();

            if (uniqueClass)
            {
                return;
            }
            string alreadyRegisteredMessage = $"Type '{type.FullName}' has already been registered " +
                                              $"with the Rpc router under the route '{routeName}'";

            throw new ArgumentException(alreadyRegisteredMessage);
        }