diff options
Diffstat (limited to 'examples/csharp/route_guide/RouteGuideServer/RouteGuideImpl.cs')
-rw-r--r-- | examples/csharp/route_guide/RouteGuideServer/RouteGuideImpl.cs | 13 |
1 files changed, 7 insertions, 6 deletions
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()) { |