diff options
Diffstat (limited to 'examples/csharp/helloworld')
11 files changed, 41 insertions, 87 deletions
diff --git a/examples/csharp/helloworld/.nuget/packages.config b/examples/csharp/helloworld/.nuget/packages.config index bfd6c6723d..aa060800c1 100644 --- a/examples/csharp/helloworld/.nuget/packages.config +++ b/examples/csharp/helloworld/.nuget/packages.config @@ -1,4 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="Grpc.Tools" version="0.14.0" /> + <package id="Grpc.Tools" version="0.15.0" /> </packages>
\ No newline at end of file diff --git a/examples/csharp/helloworld/Greeter/Greeter.csproj b/examples/csharp/helloworld/Greeter/Greeter.csproj index 0270cc25f7..20b85db8b6 100644 --- a/examples/csharp/helloworld/Greeter/Greeter.csproj +++ b/examples/csharp/helloworld/Greeter/Greeter.csproj @@ -10,7 +10,7 @@ <RootNamespace>Greeter</RootNamespace> <AssemblyName>Greeter</AssemblyName> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> - <NuGetPackageImportStamp>745ac60f</NuGetPackageImportStamp> + <NuGetPackageImportStamp>2669b4f2</NuGetPackageImportStamp> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -33,11 +33,11 @@ <ItemGroup> <Reference Include="Google.Protobuf, Version=3.0.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\packages\Google.Protobuf.3.0.0-beta2\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath> + <HintPath>..\packages\Google.Protobuf.3.0.0-beta3\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath> </Reference> <Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\packages\Grpc.Core.0.14.0\lib\net45\Grpc.Core.dll</HintPath> + <HintPath>..\packages\Grpc.Core.0.15.0\lib\net45\Grpc.Core.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Interactive.Async, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> @@ -61,11 +61,11 @@ <None Include="packages.config" /> </ItemGroup> <ItemGroup /> - <Import Project="..\packages\Grpc.Core.0.14.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.0.14.0\build\net45\Grpc.Core.targets')" /> + <Import Project="..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <PropertyGroup> <ErrorText>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}.</ErrorText> </PropertyGroup> - <Error Condition="!Exists('..\packages\Grpc.Core.0.14.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.0.14.0\build\net45\Grpc.Core.targets'))" /> + <Error Condition="!Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets'))" /> </Target> </Project>
\ No newline at end of file diff --git a/examples/csharp/helloworld/Greeter/Helloworld.cs b/examples/csharp/helloworld/Greeter/Helloworld.cs index 3cacdebe27..6477b4f35b 100644 --- a/examples/csharp/helloworld/Greeter/Helloworld.cs +++ b/examples/csharp/helloworld/Greeter/Helloworld.cs @@ -31,9 +31,9 @@ namespace Helloworld { "cm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Helloworld.HelloRequest), global::Helloworld.HelloRequest.Parser, new[]{ "Name" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Helloworld.HelloReply), global::Helloworld.HelloReply.Parser, new[]{ "Message" }, null, null, null) + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Helloworld.HelloRequest), global::Helloworld.HelloRequest.Parser, new[]{ "Name" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Helloworld.HelloReply), global::Helloworld.HelloReply.Parser, new[]{ "Message" }, null, null, null) })); } #endregion @@ -76,7 +76,7 @@ namespace Helloworld { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -182,7 +182,7 @@ namespace Helloworld { public string Message { get { return message_; } set { - message_ = pb::Preconditions.CheckNotNull(value, "value"); + message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } diff --git a/examples/csharp/helloworld/Greeter/HelloworldGrpc.cs b/examples/csharp/helloworld/Greeter/HelloworldGrpc.cs index 405f3bd724..041f5a78d7 100644 --- a/examples/csharp/helloworld/Greeter/HelloworldGrpc.cs +++ b/examples/csharp/helloworld/Greeter/HelloworldGrpc.cs @@ -61,38 +61,6 @@ namespace Helloworld { get { return global::Helloworld.HelloworldReflection.Descriptor.Services[0]; } } - /// <summary>Client for Greeter</summary> - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface IGreeterClient - { - /// <summary> - /// Sends a greeting - /// </summary> - global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// Sends a greeting - /// </summary> - global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, CallOptions options); - /// <summary> - /// Sends a greeting - /// </summary> - AsyncUnaryCall<global::Helloworld.HelloReply> SayHelloAsync(global::Helloworld.HelloRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// <summary> - /// Sends a greeting - /// </summary> - AsyncUnaryCall<global::Helloworld.HelloReply> SayHelloAsync(global::Helloworld.HelloRequest request, CallOptions options); - } - - /// <summary>Interface of server-side implementations of Greeter</summary> - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface IGreeter - { - /// <summary> - /// Sends a greeting - /// </summary> - global::System.Threading.Tasks.Task<global::Helloworld.HelloReply> SayHello(global::Helloworld.HelloRequest request, ServerCallContext context); - } - /// <summary>Base class for server-side implementations of Greeter</summary> public abstract class GreeterBase { @@ -107,21 +75,24 @@ namespace Helloworld { } /// <summary>Client for Greeter</summary> - #pragma warning disable 0618 - public class GreeterClient : ClientBase<GreeterClient>, IGreeterClient - #pragma warning restore 0618 + public class GreeterClient : ClientBase<GreeterClient> { + /// <summary>Creates a new client for Greeter</summary> + /// <param name="channel">The channel to use to make remote calls.</param> public GreeterClient(Channel channel) : base(channel) { } + /// <summary>Creates a new client for Greeter that uses a custom <c>CallInvoker</c>.</summary> + /// <param name="callInvoker">The callInvoker to use to make remote calls.</param> public GreeterClient(CallInvoker callInvoker) : base(callInvoker) { } - ///<summary>Protected parameterless constructor to allow creation of test doubles.</summary> + /// <summary>Protected parameterless constructor to allow creation of test doubles.</summary> protected GreeterClient() : base() { } - ///<summary>Protected constructor to allow creation of configured clients.</summary> + /// <summary>Protected constructor to allow creation of configured clients.</summary> + /// <param name="configuration">The client configuration.</param> protected GreeterClient(ClientBaseConfiguration configuration) : base(configuration) { } @@ -160,27 +131,10 @@ namespace Helloworld { } } - /// <summary>Creates a new client for Greeter</summary> - public static GreeterClient NewClient(Channel channel) - { - return new GreeterClient(channel); - } - - /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(IGreeter serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder(__ServiceName) - .AddMethod(__Method_SayHello, serviceImpl.SayHello).Build(); - } - /// <summary>Creates service definition that can be registered with a server</summary> - #pragma warning disable 0618 public static ServerServiceDefinition BindService(GreeterBase serviceImpl) - #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_SayHello, serviceImpl.SayHello).Build(); } diff --git a/examples/csharp/helloworld/Greeter/packages.config b/examples/csharp/helloworld/Greeter/packages.config index 617fe6da7b..ff9d6bbf73 100644 --- a/examples/csharp/helloworld/Greeter/packages.config +++ b/examples/csharp/helloworld/Greeter/packages.config @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="Google.Protobuf" version="3.0.0-beta2" targetFramework="net45" /> - <package id="Grpc" version="0.14.0" targetFramework="net45" /> - <package id="Grpc.Core" version="0.14.0" targetFramework="net45" /> + <package id="Google.Protobuf" version="3.0.0-beta3" targetFramework="net45" /> + <package id="Grpc" version="0.15.0" targetFramework="net45" /> + <package id="Grpc.Core" version="0.15.0" targetFramework="net45" /> <package id="Ix-Async" version="1.2.5" targetFramework="net45" /> </packages>
\ No newline at end of file diff --git a/examples/csharp/helloworld/GreeterClient/GreeterClient.csproj b/examples/csharp/helloworld/GreeterClient/GreeterClient.csproj index 877c450a50..2b38ce290e 100644 --- a/examples/csharp/helloworld/GreeterClient/GreeterClient.csproj +++ b/examples/csharp/helloworld/GreeterClient/GreeterClient.csproj @@ -10,7 +10,7 @@ <RootNamespace>GreeterClient</RootNamespace> <AssemblyName>GreeterClient</AssemblyName> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> - <NuGetPackageImportStamp>63b59176</NuGetPackageImportStamp> + <NuGetPackageImportStamp>5e942a7d</NuGetPackageImportStamp> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -33,11 +33,11 @@ <ItemGroup> <Reference Include="Google.Protobuf, Version=3.0.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\packages\Google.Protobuf.3.0.0-beta2\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath> + <HintPath>..\packages\Google.Protobuf.3.0.0-beta3\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath> </Reference> <Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\packages\Grpc.Core.0.14.0\lib\net45\Grpc.Core.dll</HintPath> + <HintPath>..\packages\Grpc.Core.0.15.0\lib\net45\Grpc.Core.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Interactive.Async, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> @@ -59,11 +59,11 @@ <ItemGroup> <None Include="packages.config" /> </ItemGroup> - <Import Project="..\packages\Grpc.Core.0.14.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.0.14.0\build\net45\Grpc.Core.targets')" /> + <Import Project="..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <PropertyGroup> <ErrorText>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}.</ErrorText> </PropertyGroup> - <Error Condition="!Exists('..\packages\Grpc.Core.0.14.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.0.14.0\build\net45\Grpc.Core.targets'))" /> + <Error Condition="!Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets'))" /> </Target> </Project>
\ No newline at end of file diff --git a/examples/csharp/helloworld/GreeterClient/Program.cs b/examples/csharp/helloworld/GreeterClient/Program.cs index 4393f2f3c2..444d473509 100644 --- a/examples/csharp/helloworld/GreeterClient/Program.cs +++ b/examples/csharp/helloworld/GreeterClient/Program.cs @@ -39,7 +39,7 @@ namespace GreeterClient { Channel channel = new Channel("127.0.0.1:50051", ChannelCredentials.Insecure); - var client = Greeter.NewClient(channel); + var client = new Greeter.GreeterClient(channel); String user = "you"; var reply = client.SayHello(new HelloRequest { Name = user }); diff --git a/examples/csharp/helloworld/GreeterClient/packages.config b/examples/csharp/helloworld/GreeterClient/packages.config index 617fe6da7b..ff9d6bbf73 100644 --- a/examples/csharp/helloworld/GreeterClient/packages.config +++ b/examples/csharp/helloworld/GreeterClient/packages.config @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="Google.Protobuf" version="3.0.0-beta2" targetFramework="net45" /> - <package id="Grpc" version="0.14.0" targetFramework="net45" /> - <package id="Grpc.Core" version="0.14.0" targetFramework="net45" /> + <package id="Google.Protobuf" version="3.0.0-beta3" targetFramework="net45" /> + <package id="Grpc" version="0.15.0" targetFramework="net45" /> + <package id="Grpc.Core" version="0.15.0" targetFramework="net45" /> <package id="Ix-Async" version="1.2.5" targetFramework="net45" /> </packages>
\ No newline at end of file diff --git a/examples/csharp/helloworld/GreeterServer/GreeterServer.csproj b/examples/csharp/helloworld/GreeterServer/GreeterServer.csproj index 4d792dcf32..43c633678b 100644 --- a/examples/csharp/helloworld/GreeterServer/GreeterServer.csproj +++ b/examples/csharp/helloworld/GreeterServer/GreeterServer.csproj @@ -10,7 +10,7 @@ <RootNamespace>GreeterServer</RootNamespace> <AssemblyName>GreeterServer</AssemblyName> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> - <NuGetPackageImportStamp>25ac2e80</NuGetPackageImportStamp> + <NuGetPackageImportStamp>9c7b2963</NuGetPackageImportStamp> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -33,11 +33,11 @@ <ItemGroup> <Reference Include="Google.Protobuf, Version=3.0.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\packages\Google.Protobuf.3.0.0-beta2\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath> + <HintPath>..\packages\Google.Protobuf.3.0.0-beta3\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath> </Reference> <Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\packages\Grpc.Core.0.14.0\lib\net45\Grpc.Core.dll</HintPath> + <HintPath>..\packages\Grpc.Core.0.15.0\lib\net45\Grpc.Core.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Interactive.Async, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> @@ -59,11 +59,11 @@ <ItemGroup> <None Include="packages.config" /> </ItemGroup> - <Import Project="..\packages\Grpc.Core.0.14.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.0.14.0\build\net45\Grpc.Core.targets')" /> + <Import Project="..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <PropertyGroup> <ErrorText>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}.</ErrorText> </PropertyGroup> - <Error Condition="!Exists('..\packages\Grpc.Core.0.14.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.0.14.0\build\net45\Grpc.Core.targets'))" /> + <Error Condition="!Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets'))" /> </Target> </Project>
\ No newline at end of file diff --git a/examples/csharp/helloworld/GreeterServer/packages.config b/examples/csharp/helloworld/GreeterServer/packages.config index 617fe6da7b..ff9d6bbf73 100644 --- a/examples/csharp/helloworld/GreeterServer/packages.config +++ b/examples/csharp/helloworld/GreeterServer/packages.config @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="Google.Protobuf" version="3.0.0-beta2" targetFramework="net45" /> - <package id="Grpc" version="0.14.0" targetFramework="net45" /> - <package id="Grpc.Core" version="0.14.0" targetFramework="net45" /> + <package id="Google.Protobuf" version="3.0.0-beta3" targetFramework="net45" /> + <package id="Grpc" version="0.15.0" targetFramework="net45" /> + <package id="Grpc.Core" version="0.15.0" targetFramework="net45" /> <package id="Ix-Async" version="1.2.5" targetFramework="net45" /> </packages>
\ No newline at end of file diff --git a/examples/csharp/helloworld/generate_protos.bat b/examples/csharp/helloworld/generate_protos.bat index b9f68d6745..a952bb46cd 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.14.0\tools\windows_x86 +set TOOLS_PATH=packages\Grpc.Tools.0.15.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 |