コード例 #1
0
        private void AddMethodCore(IMethod method, RequestDelegate requestDelegate, List <object> metadata)
        {
            ServiceMethods.Add(method);

            var resolvedMetadata = new List <object>();

            // IMethod is added as metadata for the endpoint
            resolvedMetadata.Add(new GrpcMethodMetadata(typeof(TService), method));
            resolvedMetadata.AddRange(metadata);

            var pattern = method.FullName;

            var endpointBuilder = _builder.MapPost(pattern, requestDelegate);

            endpointBuilder.Add(ep =>
            {
                ep.DisplayName = $"gRPC - {method.FullName}";
                foreach (var item in resolvedMetadata)
                {
                    ep.Metadata.Add(item);
                }
            });

            EndpointConventionBuilders.Add(endpointBuilder);

            Log.ServiceMethodAdded(_logger, method.Name, method.ServiceName, method.Type, pattern);
        }
コード例 #2
0
        private void AddMethodCore(IMethod method, RequestDelegate requestDelegate, List <object> metadata)
        {
            ServiceMethods.Add(method);

            var resolvedMetadata = new List <object>();

            // IMethod is added as metadata for the endpoint
            resolvedMetadata.Add(method);
            resolvedMetadata.AddRange(metadata);

            EndpointConventionBuilders.Add(_builder.MapPost(method.FullName, $"gRPC - {method.FullName}", requestDelegate, resolvedMetadata.ToArray()));
        }
コード例 #3
0
        private void AddMethodCore(IMethod method, RequestDelegate requestDelegate, List <object> metadata)
        {
            ServiceMethods.Add(method);

            var resolvedMetadata = new List <object>();

            // IMethod is added as metadata for the endpoint
            resolvedMetadata.Add(method);
            resolvedMetadata.AddRange(metadata);

            var pattern = method.FullName;

            var endpointBuilder = _builder
                                  .MapPost(pattern, requestDelegate)
                                  .WithDisplayName($"gRPC - {method.FullName}")
                                  .WithMetadata(resolvedMetadata.ToArray());

            EndpointConventionBuilders.Add(endpointBuilder);

            Log.ServiceMethodAdded(_logger, method.Name, method.ServiceName, method.Type, pattern);
        }