diff options
author | 2015-02-05 18:33:27 -0800 | |
---|---|---|
committer | 2015-02-05 18:33:27 -0800 | |
commit | 3d6fa14f1a94fcb5c9b917b2e6e76cea6d13f2bb (patch) | |
tree | 9fe73f6c4e6cc2d16fd77ff1df53bbcc67db8794 /src/csharp/GrpcCore/ServerCalls.cs | |
parent | e83fe4c9035f195717d6db0f0aad1e8f5ac44999 (diff) | |
parent | caa361466c5144878d8053fc8844b3fa816c5981 (diff) |
Merge pull request #411 from jtattermusch/csharp_server
Improved C# grpc server implementation to be able to register call handlers
Diffstat (limited to 'src/csharp/GrpcCore/ServerCalls.cs')
-rw-r--r-- | src/csharp/GrpcCore/ServerCalls.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/csharp/GrpcCore/ServerCalls.cs b/src/csharp/GrpcCore/ServerCalls.cs new file mode 100644 index 0000000000..86c4718932 --- /dev/null +++ b/src/csharp/GrpcCore/ServerCalls.cs @@ -0,0 +1,25 @@ +using System; + +namespace Google.GRPC.Core +{ + // TODO: perhaps add also serverSideStreaming and clientSideStreaming + + public delegate void UnaryRequestServerMethod<TRequest, TResponse> (TRequest request, IObserver<TResponse> responseObserver); + + public delegate IObserver<TRequest> StreamingRequestServerMethod<TRequest, TResponse> (IObserver<TResponse> responseObserver); + + internal static class ServerCalls { + + public static IServerCallHandler UnaryRequestCall<TRequest, TResponse>(Method<TRequest, TResponse> method, UnaryRequestServerMethod<TRequest, TResponse> handler) + { + return new UnaryRequestServerCallHandler<TRequest, TResponse>(method, handler); + } + + public static IServerCallHandler StreamingRequestCall<TRequest, TResponse>(Method<TRequest, TResponse> method, StreamingRequestServerMethod<TRequest, TResponse> handler) + { + return new StreamingRequestServerCallHandler<TRequest, TResponse>(method, handler); + } + + } +} + |