aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/csharp
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2016-05-11 15:35:46 -0700
committerGravatar Jan Tattermusch <jtattermusch@google.com>2016-05-11 15:35:46 -0700
commit0bbbb3240e9cb43a09dfd6b18b07764ff0733f5c (patch)
treed9b37b97b657e5d970868cbc6ab172efa9822069 /examples/csharp
parent1aa52a074a15a2e00bf0ee19f1265aa72cdef446 (diff)
migrate Greeter and Routeguide to 0.14.0 API
Diffstat (limited to 'examples/csharp')
-rw-r--r--examples/csharp/helloworld/GreeterServer/Program.cs4
-rw-r--r--examples/csharp/route_guide/RouteGuideClient/Program.cs4
-rw-r--r--examples/csharp/route_guide/RouteGuideServer/RouteGuideImpl.cs13
3 files changed, 11 insertions, 10 deletions
diff --git a/examples/csharp/helloworld/GreeterServer/Program.cs b/examples/csharp/helloworld/GreeterServer/Program.cs
index 79f421df9e..fdab379e81 100644
--- a/examples/csharp/helloworld/GreeterServer/Program.cs
+++ b/examples/csharp/helloworld/GreeterServer/Program.cs
@@ -34,10 +34,10 @@ using Helloworld;
namespace GreeterServer
{
- class GreeterImpl : Greeter.IGreeter
+ class GreeterImpl : Greeter.GreeterBase
{
// Server side handler of the SayHello RPC
- public Task<HelloReply> SayHello(HelloRequest request, ServerCallContext context)
+ public override Task<HelloReply> SayHello(HelloRequest request, ServerCallContext context)
{
return Task.FromResult(new HelloReply { Message = "Hello " + request.Name });
}
diff --git a/examples/csharp/route_guide/RouteGuideClient/Program.cs b/examples/csharp/route_guide/RouteGuideClient/Program.cs
index c561a9f7aa..ee51fbe8e0 100644
--- a/examples/csharp/route_guide/RouteGuideClient/Program.cs
+++ b/examples/csharp/route_guide/RouteGuideClient/Program.cs
@@ -43,9 +43,9 @@ namespace Routeguide
/// </summary>
public class RouteGuideClient
{
- readonly RouteGuide.IRouteGuideClient client;
+ readonly RouteGuide.RouteGuideClient client;
- public RouteGuideClient(RouteGuide.IRouteGuideClient client)
+ public RouteGuideClient(RouteGuide.RouteGuideClient client)
{
this.client = client;
}
diff --git a/examples/csharp/route_guide/RouteGuideServer/RouteGuideImpl.cs b/examples/csharp/route_guide/RouteGuideServer/RouteGuideImpl.cs
index 20784fdcf3..7a466e7483 100644
--- a/examples/csharp/route_guide/RouteGuideServer/RouteGuideImpl.cs
+++ b/examples/csharp/route_guide/RouteGuideServer/RouteGuideImpl.cs
@@ -35,6 +35,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Grpc.Core;
using Grpc.Core.Utils;
namespace Routeguide
@@ -42,11 +43,11 @@ namespace Routeguide
/// <summary>
/// Example implementation of RouteGuide server.
/// </summary>
- public class RouteGuideImpl : RouteGuide.IRouteGuide
+ public class RouteGuideImpl : RouteGuide.RouteGuideBase
{
readonly List<Feature> features;
readonly object myLock = new object();
- readonly Dictionary<Point, List<RouteNote>> routeNotes = new Dictionary<Point, List<RouteNote>>();
+ readonly Dictionary<Point, List<RouteNote>> routeNotes = new Dictionary<Point, List<RouteNote>>();
public RouteGuideImpl(List<Feature> features)
{
@@ -57,7 +58,7 @@ namespace Routeguide
/// Gets the feature at the requested point. If no feature at that location
/// exists, an unnammed feature is returned at the provided location.
/// </summary>
- public Task<Feature> GetFeature(Point request, Grpc.Core.ServerCallContext context)
+ public override Task<Feature> GetFeature(Point request, ServerCallContext context)
{
return Task.FromResult(CheckFeature(request));
}
@@ -65,7 +66,7 @@ namespace Routeguide
/// <summary>
/// Gets all features contained within the given bounding rectangle.
/// </summary>
- public async Task ListFeatures(Rectangle request, Grpc.Core.IServerStreamWriter<Feature> responseStream, Grpc.Core.ServerCallContext context)
+ public override async Task ListFeatures(Rectangle request, IServerStreamWriter<Feature> responseStream, ServerCallContext context)
{
var responses = features.FindAll( (feature) => feature.Exists() && request.Contains(feature.Location) );
foreach (var response in responses)
@@ -78,7 +79,7 @@ namespace Routeguide
/// Gets a stream of points, and responds with statistics about the "trip": number of points,
/// number of known features visited, total distance traveled, and total time spent.
/// </summary>
- public async Task<RouteSummary> RecordRoute(Grpc.Core.IAsyncStreamReader<Point> requestStream, Grpc.Core.ServerCallContext context)
+ public override async Task<RouteSummary> RecordRoute(IAsyncStreamReader<Point> requestStream, ServerCallContext context)
{
int pointCount = 0;
int featureCount = 0;
@@ -117,7 +118,7 @@ namespace Routeguide
/// Receives a stream of message/location pairs, and responds with a stream of all previous
/// messages at each of those locations.
/// </summary>
- public async Task RouteChat(Grpc.Core.IAsyncStreamReader<RouteNote> requestStream, Grpc.Core.IServerStreamWriter<RouteNote> responseStream, Grpc.Core.ServerCallContext context)
+ public override async Task RouteChat(IAsyncStreamReader<RouteNote> requestStream, IServerStreamWriter<RouteNote> responseStream, ServerCallContext context)
{
while (await requestStream.MoveNext())
{