Skip to content

Commit 91130a7

Browse files
authored
Update ServiceBinderBase.AddMethod annotations to allow null handler (#2270)
1 parent 3f90844 commit 91130a7

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/Grpc.AspNetCore.Server/Model/Internal/ProviderServiceBinder.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#region Copyright notice and license
1+
#region Copyright notice and license
22

33
// Copyright 2019 The gRPC Authors
44
//
@@ -39,7 +39,7 @@ internal ProviderServiceBinder(ServiceMethodProviderContext<TService> context, T
3939
_declaringType = declaringType;
4040
}
4141

42-
public override void AddMethod<TRequest, TResponse>(Method<TRequest, TResponse> method, ClientStreamingServerMethod<TRequest, TResponse> handler)
42+
public override void AddMethod<TRequest, TResponse>(Method<TRequest, TResponse> method, ClientStreamingServerMethod<TRequest, TResponse>? handler)
4343
{
4444
var (invoker, metadata) = CreateModelCore<ClientStreamingServerMethod<TService, TRequest, TResponse>>(
4545
method.Name,
@@ -48,7 +48,7 @@ public override void AddMethod<TRequest, TResponse>(Method<TRequest, TResponse>
4848
_context.AddClientStreamingMethod<TRequest, TResponse>(method, metadata, invoker);
4949
}
5050

51-
public override void AddMethod<TRequest, TResponse>(Method<TRequest, TResponse> method, DuplexStreamingServerMethod<TRequest, TResponse> handler)
51+
public override void AddMethod<TRequest, TResponse>(Method<TRequest, TResponse> method, DuplexStreamingServerMethod<TRequest, TResponse>? handler)
5252
{
5353
var (invoker, metadata) = CreateModelCore<DuplexStreamingServerMethod<TService, TRequest, TResponse>>(
5454
method.Name,
@@ -57,7 +57,7 @@ public override void AddMethod<TRequest, TResponse>(Method<TRequest, TResponse>
5757
_context.AddDuplexStreamingMethod<TRequest, TResponse>(method, metadata, invoker);
5858
}
5959

60-
public override void AddMethod<TRequest, TResponse>(Method<TRequest, TResponse> method, ServerStreamingServerMethod<TRequest, TResponse> handler)
60+
public override void AddMethod<TRequest, TResponse>(Method<TRequest, TResponse> method, ServerStreamingServerMethod<TRequest, TResponse>? handler)
6161
{
6262
var (invoker, metadata) = CreateModelCore<ServerStreamingServerMethod<TService, TRequest, TResponse>>(
6363
method.Name,
@@ -66,7 +66,7 @@ public override void AddMethod<TRequest, TResponse>(Method<TRequest, TResponse>
6666
_context.AddServerStreamingMethod<TRequest, TResponse>(method, metadata, invoker);
6767
}
6868

69-
public override void AddMethod<TRequest, TResponse>(Method<TRequest, TResponse> method, UnaryServerMethod<TRequest, TResponse> handler)
69+
public override void AddMethod<TRequest, TResponse>(Method<TRequest, TResponse> method, UnaryServerMethod<TRequest, TResponse>? handler)
7070
{
7171
var (invoker, metadata) = CreateModelCore<UnaryServerMethod<TService, TRequest, TResponse>>(
7272
method.Name,

src/Grpc.Core.Api/ServiceBinderBase.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class ServiceBinderBase
4040
/// <param name="handler">The method handler.</param>
4141
public virtual void AddMethod<TRequest, TResponse>(
4242
Method<TRequest, TResponse> method,
43-
UnaryServerMethod<TRequest, TResponse> handler)
43+
UnaryServerMethod<TRequest, TResponse>? handler)
4444
where TRequest : class
4545
where TResponse : class
4646
{
@@ -56,7 +56,7 @@ public virtual void AddMethod<TRequest, TResponse>(
5656
/// <param name="handler">The method handler.</param>
5757
public virtual void AddMethod<TRequest, TResponse>(
5858
Method<TRequest, TResponse> method,
59-
ClientStreamingServerMethod<TRequest, TResponse> handler)
59+
ClientStreamingServerMethod<TRequest, TResponse>? handler)
6060
where TRequest : class
6161
where TResponse : class
6262
{
@@ -72,7 +72,7 @@ public virtual void AddMethod<TRequest, TResponse>(
7272
/// <param name="handler">The method handler.</param>
7373
public virtual void AddMethod<TRequest, TResponse>(
7474
Method<TRequest, TResponse> method,
75-
ServerStreamingServerMethod<TRequest, TResponse> handler)
75+
ServerStreamingServerMethod<TRequest, TResponse>? handler)
7676
where TRequest : class
7777
where TResponse : class
7878
{
@@ -88,7 +88,7 @@ public virtual void AddMethod<TRequest, TResponse>(
8888
/// <param name="handler">The method handler.</param>
8989
public virtual void AddMethod<TRequest, TResponse>(
9090
Method<TRequest, TResponse> method,
91-
DuplexStreamingServerMethod<TRequest, TResponse> handler)
91+
DuplexStreamingServerMethod<TRequest, TResponse>? handler)
9292
where TRequest : class
9393
where TResponse : class
9494
{

0 commit comments

Comments
 (0)