From 0bbbb3240e9cb43a09dfd6b18b07764ff0733f5c Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 May 2016 15:35:46 -0700 Subject: migrate Greeter and Routeguide to 0.14.0 API --- examples/csharp/route_guide/RouteGuideClient/Program.cs | 4 ++-- .../csharp/route_guide/RouteGuideServer/RouteGuideImpl.cs | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'examples/csharp/route_guide') 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 /// 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 /// /// Example implementation of RouteGuide server. /// - public class RouteGuideImpl : RouteGuide.IRouteGuide + public class RouteGuideImpl : RouteGuide.RouteGuideBase { readonly List features; readonly object myLock = new object(); - readonly Dictionary> routeNotes = new Dictionary>(); + readonly Dictionary> routeNotes = new Dictionary>(); public RouteGuideImpl(List 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. /// - public Task GetFeature(Point request, Grpc.Core.ServerCallContext context) + public override Task GetFeature(Point request, ServerCallContext context) { return Task.FromResult(CheckFeature(request)); } @@ -65,7 +66,7 @@ namespace Routeguide /// /// Gets all features contained within the given bounding rectangle. /// - public async Task ListFeatures(Rectangle request, Grpc.Core.IServerStreamWriter responseStream, Grpc.Core.ServerCallContext context) + public override async Task ListFeatures(Rectangle request, IServerStreamWriter 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. /// - public async Task RecordRoute(Grpc.Core.IAsyncStreamReader requestStream, Grpc.Core.ServerCallContext context) + public override async Task RecordRoute(IAsyncStreamReader 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. /// - public async Task RouteChat(Grpc.Core.IAsyncStreamReader requestStream, Grpc.Core.IServerStreamWriter responseStream, Grpc.Core.ServerCallContext context) + public override async Task RouteChat(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context) { while (await requestStream.MoveNext()) { -- cgit v1.2.3