aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Michael Lumish <mlumish@google.com>2015-05-12 15:54:05 -0700
committerGravatar Michael Lumish <mlumish@google.com>2015-05-12 15:54:05 -0700
commitc524c60da93a3bb1af0873d2325472eed10b7d8f (patch)
tree876983696a43b1abc0b5edc5ebfa27baf549c567 /src
parenta468c36601dd5997580129bbd66b5ebed02521f8 (diff)
parentbee9325d56956322f9116d544bac250ad3248307 (diff)
Merge pull request #1562 from jtattermusch/fix_csharp_interop
Fix C# interop tests
Diffstat (limited to 'src')
-rw-r--r--src/csharp/Grpc.Core/Call.cs2
-rw-r--r--src/csharp/Grpc.Core/Method.cs9
-rw-r--r--src/csharp/Grpc.Core/ServerServiceDefinition.cs13
3 files changed, 14 insertions, 10 deletions
diff --git a/src/csharp/Grpc.Core/Call.cs b/src/csharp/Grpc.Core/Call.cs
index 771cc083da..d1ee59ff0a 100644
--- a/src/csharp/Grpc.Core/Call.cs
+++ b/src/csharp/Grpc.Core/Call.cs
@@ -52,7 +52,7 @@ namespace Grpc.Core
public Call(string serviceName, Method<TRequest, TResponse> method, Channel channel, Metadata headers)
{
- this.name = Preconditions.CheckNotNull(serviceName) + "/" + method.Name;
+ this.name = method.GetFullName(serviceName);
this.requestMarshaller = method.RequestMarshaller;
this.responseMarshaller = method.ResponseMarshaller;
this.channel = Preconditions.CheckNotNull(channel);
diff --git a/src/csharp/Grpc.Core/Method.cs b/src/csharp/Grpc.Core/Method.cs
index 156e780c7d..77d36191c3 100644
--- a/src/csharp/Grpc.Core/Method.cs
+++ b/src/csharp/Grpc.Core/Method.cs
@@ -32,6 +32,7 @@
#endregion
using System;
+using Grpc.Core.Utils;
namespace Grpc.Core
{
@@ -95,5 +96,13 @@ namespace Grpc.Core
return this.responseMarshaller;
}
}
+
+ /// <summary>
+ /// Gets full name of the method including the service name.
+ /// </summary>
+ internal string GetFullName(string serviceName)
+ {
+ return "/" + Preconditions.CheckNotNull(serviceName) + "/" + this.Name;
+ }
}
}
diff --git a/src/csharp/Grpc.Core/ServerServiceDefinition.cs b/src/csharp/Grpc.Core/ServerServiceDefinition.cs
index 81846beb2f..b180186c12 100644
--- a/src/csharp/Grpc.Core/ServerServiceDefinition.cs
+++ b/src/csharp/Grpc.Core/ServerServiceDefinition.cs
@@ -79,7 +79,7 @@ namespace Grpc.Core
where TRequest : class
where TResponse : class
{
- callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.UnaryCall(method, handler));
+ callHandlers.Add(method.GetFullName(serviceName), ServerCalls.UnaryCall(method, handler));
return this;
}
@@ -89,7 +89,7 @@ namespace Grpc.Core
where TRequest : class
where TResponse : class
{
- callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.ClientStreamingCall(method, handler));
+ callHandlers.Add(method.GetFullName(serviceName), ServerCalls.ClientStreamingCall(method, handler));
return this;
}
@@ -99,7 +99,7 @@ namespace Grpc.Core
where TRequest : class
where TResponse : class
{
- callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.ServerStreamingCall(method, handler));
+ callHandlers.Add(method.GetFullName(serviceName), ServerCalls.ServerStreamingCall(method, handler));
return this;
}
@@ -109,7 +109,7 @@ namespace Grpc.Core
where TRequest : class
where TResponse : class
{
- callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.DuplexStreamingCall(method, handler));
+ callHandlers.Add(method.GetFullName(serviceName), ServerCalls.DuplexStreamingCall(method, handler));
return this;
}
@@ -117,11 +117,6 @@ namespace Grpc.Core
{
return new ServerServiceDefinition(callHandlers.ToImmutableDictionary());
}
-
- private string GetFullMethodName(string serviceName, string methodName)
- {
- return serviceName + "/" + methodName;
- }
}
}
}