diff --git a/examples/csharp/helloworld/.nuget/packages.config b/examples/csharp/helloworld/.nuget/packages.config index 0f89a66e25f..bfd6c6723d9 100644 --- a/examples/csharp/helloworld/.nuget/packages.config +++ b/examples/csharp/helloworld/.nuget/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/examples/csharp/helloworld/Greeter/Greeter.csproj b/examples/csharp/helloworld/Greeter/Greeter.csproj index 1e9399f7981..0270cc25f7a 100644 --- a/examples/csharp/helloworld/Greeter/Greeter.csproj +++ b/examples/csharp/helloworld/Greeter/Greeter.csproj @@ -10,7 +10,7 @@ Greeter Greeter v4.5 - 96275748 + 745ac60f true @@ -35,9 +35,9 @@ False ..\packages\Google.Protobuf.3.0.0-beta2\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll - + False - ..\packages\Grpc.Core.0.13.1\lib\net45\Grpc.Core.dll + ..\packages\Grpc.Core.0.14.0\lib\net45\Grpc.Core.dll @@ -61,11 +61,11 @@ - + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + \ No newline at end of file diff --git a/examples/csharp/helloworld/Greeter/HelloworldGrpc.cs b/examples/csharp/helloworld/Greeter/HelloworldGrpc.cs index 4014bc21e32..405f3bd7248 100644 --- a/examples/csharp/helloworld/Greeter/HelloworldGrpc.cs +++ b/examples/csharp/helloworld/Greeter/HelloworldGrpc.cs @@ -1,5 +1,35 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: helloworld.proto +// Original file comments: +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// #region Designer generated code using System; @@ -8,6 +38,9 @@ using System.Threading.Tasks; using Grpc.Core; namespace Helloworld { + /// + /// The greeting service definition. + /// public static class Greeter { static readonly string __ServiceName = "helloworld.Greeter"; @@ -22,66 +55,133 @@ namespace Helloworld { __Marshaller_HelloRequest, __Marshaller_HelloReply); - // service descriptor + /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { get { return global::Helloworld.HelloworldReflection.Descriptor.Services[0]; } } - // client interface + /// Client for Greeter + [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] public interface IGreeterClient { + /// + /// Sends a greeting + /// global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Sends a greeting + /// global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, CallOptions options); + /// + /// Sends a greeting + /// AsyncUnaryCall SayHelloAsync(global::Helloworld.HelloRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Sends a greeting + /// AsyncUnaryCall SayHelloAsync(global::Helloworld.HelloRequest request, CallOptions options); } - // server-side interface + /// Interface of server-side implementations of Greeter + [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] public interface IGreeter { - Task SayHello(global::Helloworld.HelloRequest request, ServerCallContext context); + /// + /// Sends a greeting + /// + global::System.Threading.Tasks.Task SayHello(global::Helloworld.HelloRequest request, ServerCallContext context); } - // client stub - public class GreeterClient : ClientBase, IGreeterClient + /// Base class for server-side implementations of Greeter + public abstract class GreeterBase + { + /// + /// Sends a greeting + /// + public virtual global::System.Threading.Tasks.Task SayHello(global::Helloworld.HelloRequest request, ServerCallContext context) + { + throw new RpcException(new Status(StatusCode.Unimplemented, "")); + } + + } + + /// Client for Greeter + #pragma warning disable 0618 + public class GreeterClient : ClientBase, IGreeterClient + #pragma warning restore 0618 { public GreeterClient(Channel channel) : base(channel) { } - public global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + public GreeterClient(CallInvoker callInvoker) : base(callInvoker) + { + } + ///Protected parameterless constructor to allow creation of test doubles. + protected GreeterClient() : base() + { + } + ///Protected constructor to allow creation of configured clients. + protected GreeterClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// Sends a greeting + /// + public virtual global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return SayHello(request, new CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Sends a greeting + /// + public virtual global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, CallOptions options) { - var call = CreateCall(__Method_SayHello, new CallOptions(headers, deadline, cancellationToken)); - return Calls.BlockingUnaryCall(call, request); + return CallInvoker.BlockingUnaryCall(__Method_SayHello, null, options, request); } - public global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, CallOptions options) + /// + /// Sends a greeting + /// + public virtual AsyncUnaryCall SayHelloAsync(global::Helloworld.HelloRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { - var call = CreateCall(__Method_SayHello, options); - return Calls.BlockingUnaryCall(call, request); + return SayHelloAsync(request, new CallOptions(headers, deadline, cancellationToken)); } - public AsyncUnaryCall SayHelloAsync(global::Helloworld.HelloRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Sends a greeting + /// + public virtual AsyncUnaryCall SayHelloAsync(global::Helloworld.HelloRequest request, CallOptions options) { - var call = CreateCall(__Method_SayHello, new CallOptions(headers, deadline, cancellationToken)); - return Calls.AsyncUnaryCall(call, request); + return CallInvoker.AsyncUnaryCall(__Method_SayHello, null, options, request); } - public AsyncUnaryCall SayHelloAsync(global::Helloworld.HelloRequest request, CallOptions options) + protected override GreeterClient NewInstance(ClientBaseConfiguration configuration) { - var call = CreateCall(__Method_SayHello, options); - return Calls.AsyncUnaryCall(call, request); + return new GreeterClient(configuration); } } - // creates service definition that can be registered with a server + /// Creates a new client for Greeter + public static GreeterClient NewClient(Channel channel) + { + return new GreeterClient(channel); + } + + /// Creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(IGreeter serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_SayHello, serviceImpl.SayHello).Build(); } - // creates a new client - public static GreeterClient NewClient(Channel channel) + /// Creates service definition that can be registered with a server + #pragma warning disable 0618 + public static ServerServiceDefinition BindService(GreeterBase serviceImpl) + #pragma warning restore 0618 { - return new GreeterClient(channel); + return ServerServiceDefinition.CreateBuilder(__ServiceName) + .AddMethod(__Method_SayHello, serviceImpl.SayHello).Build(); } } diff --git a/examples/csharp/helloworld/Greeter/packages.config b/examples/csharp/helloworld/Greeter/packages.config index 7d24440b123..617fe6da7be 100644 --- a/examples/csharp/helloworld/Greeter/packages.config +++ b/examples/csharp/helloworld/Greeter/packages.config @@ -1,8 +1,7 @@  - - - + + \ No newline at end of file diff --git a/examples/csharp/helloworld/GreeterClient/GreeterClient.csproj b/examples/csharp/helloworld/GreeterClient/GreeterClient.csproj index e10a6058df1..877c450a50e 100644 --- a/examples/csharp/helloworld/GreeterClient/GreeterClient.csproj +++ b/examples/csharp/helloworld/GreeterClient/GreeterClient.csproj @@ -10,7 +10,7 @@ GreeterClient GreeterClient v4.5 - d94f6f5f + 63b59176 true @@ -35,9 +35,9 @@ False ..\packages\Google.Protobuf.3.0.0-beta2\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll - + False - ..\packages\Grpc.Core.0.13.1\lib\net45\Grpc.Core.dll + ..\packages\Grpc.Core.0.14.0\lib\net45\Grpc.Core.dll @@ -59,11 +59,11 @@ - + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + \ No newline at end of file diff --git a/examples/csharp/helloworld/GreeterClient/packages.config b/examples/csharp/helloworld/GreeterClient/packages.config index 7d24440b123..617fe6da7be 100644 --- a/examples/csharp/helloworld/GreeterClient/packages.config +++ b/examples/csharp/helloworld/GreeterClient/packages.config @@ -1,8 +1,7 @@  - - - + + \ No newline at end of file diff --git a/examples/csharp/helloworld/GreeterServer/GreeterServer.csproj b/examples/csharp/helloworld/GreeterServer/GreeterServer.csproj index 6c70f75087d..4d792dcf32e 100644 --- a/examples/csharp/helloworld/GreeterServer/GreeterServer.csproj +++ b/examples/csharp/helloworld/GreeterServer/GreeterServer.csproj @@ -10,7 +10,7 @@ GreeterServer GreeterServer v4.5 - 6f89e9f2 + 25ac2e80 true @@ -35,9 +35,9 @@ False ..\packages\Google.Protobuf.3.0.0-beta2\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll - + False - ..\packages\Grpc.Core.0.13.1\lib\net45\Grpc.Core.dll + ..\packages\Grpc.Core.0.14.0\lib\net45\Grpc.Core.dll @@ -59,11 +59,11 @@ - + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + \ No newline at end of file diff --git a/examples/csharp/helloworld/GreeterServer/Program.cs b/examples/csharp/helloworld/GreeterServer/Program.cs index 79f421df9e1..fdab379e81d 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 SayHello(HelloRequest request, ServerCallContext context) + public override Task SayHello(HelloRequest request, ServerCallContext context) { return Task.FromResult(new HelloReply { Message = "Hello " + request.Name }); } diff --git a/examples/csharp/helloworld/GreeterServer/packages.config b/examples/csharp/helloworld/GreeterServer/packages.config index 7d24440b123..617fe6da7be 100644 --- a/examples/csharp/helloworld/GreeterServer/packages.config +++ b/examples/csharp/helloworld/GreeterServer/packages.config @@ -1,8 +1,7 @@  - - - + + \ No newline at end of file diff --git a/examples/csharp/helloworld/generate_protos.bat b/examples/csharp/helloworld/generate_protos.bat index 3be1ceb80ff..b9f68d6745a 100644 --- a/examples/csharp/helloworld/generate_protos.bat +++ b/examples/csharp/helloworld/generate_protos.bat @@ -34,7 +34,7 @@ setlocal @rem enter this directory cd /d %~dp0 -set TOOLS_PATH=packages\Grpc.Tools.0.13.1\tools\windows_x86 +set TOOLS_PATH=packages\Grpc.Tools.0.14.0\tools\windows_x86 %TOOLS_PATH%\protoc.exe -I../../protos --csharp_out Greeter ../../protos/helloworld.proto --grpc_out Greeter --plugin=protoc-gen-grpc=%TOOLS_PATH%\grpc_csharp_plugin.exe diff --git a/examples/csharp/route_guide/.nuget/packages.config b/examples/csharp/route_guide/.nuget/packages.config index 0f89a66e25f..bfd6c6723d9 100644 --- a/examples/csharp/route_guide/.nuget/packages.config +++ b/examples/csharp/route_guide/.nuget/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/examples/csharp/route_guide/RouteGuide/RouteGuide.csproj b/examples/csharp/route_guide/RouteGuide/RouteGuide.csproj index eba1226b900..4f7222ebba3 100644 --- a/examples/csharp/route_guide/RouteGuide/RouteGuide.csproj +++ b/examples/csharp/route_guide/RouteGuide/RouteGuide.csproj @@ -11,7 +11,7 @@ RouteGuide v4.5 512 - e1e648e7 + 0a9fcb7a true @@ -35,9 +35,9 @@ False ..\packages\Google.Protobuf.3.0.0-beta2\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll - + False - ..\packages\Grpc.Core.0.13.1\lib\net45\Grpc.Core.dll + ..\packages\Grpc.Core.0.14.0\lib\net45\Grpc.Core.dll False @@ -74,12 +74,12 @@ - + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - +