/// <summary>
        /// Constructor for <see cref="GrpcMethodInfo"/>.
        /// Parses different information about gRPC call
        /// </summary>
        /// <param name="fullName">full name of gRPC call including service name and method name</param>
        /// <param name="type">Type of the gRPC call</param>
        public GrpcMethodInfo(string fullName, Grpc.Core.MethodType type)
        {
            string[] names = fullName.Split('/');
            _type = type;

            ServiceName = names[1];
            Name        = names[2];
        }
Ejemplo n.º 2
0
 protected GrpcProxyMethod(
     GrpcCore.MethodType methodType,
     string serviceName,
     string methodName,
     IRpcSerializer?serializerOverride,
     RpcClientFaultHandler?faultHandler)
     : base(serializerOverride, faultHandler)
 {
     this.MethodType  = methodType;
     this.ServiceName = serviceName;
     this.MethodName  = methodName;
 }
        public static GrpcCore.Method <TRequest, TResponse> Create <TRequest, TResponse>(
            GrpcCore.MethodType methodType,
            string serviceName,
            string methodName,
            IRpcSerializer serializer
            )
        {
            var requestSerializer  = serializer.CreateTyped <TRequest>();
            var responseSerializer = serializer.CreateTyped <TResponse>();

            return(new GrpcCore.Method <TRequest, TResponse>(
                       type: methodType,
                       serviceName: serviceName,
                       name: methodName,
                       requestMarshaller: GrpcCore.Marshallers.Create <TRequest>(
                           serializer: requestSerializer.Serialize,
                           deserializer: requestSerializer.Deserialize !
                           ),
                       responseMarshaller: GrpcCore.Marshallers.Create <TResponse>(
                           serializer: responseSerializer.Serialize,
                           deserializer: responseSerializer.Deserialize !
                           )
                       ));
        }
Ejemplo n.º 4
0
 private GrpcCore.Method <TRequest, TResponse> GetMethodDefinition <TRequest, TResponse>(GrpcCore.MethodType methodType, string serviceName, string methodName)
     where TRequest : class
     where TResponse : class
 {
     return(MethodDefinitionGenerator.CreateMethodDefinition <TRequest, TResponse>(methodType, serviceName, methodName, this._serializer));
 }