-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from max-ieremenko/release/1.4.2
release/1.4.2
- Loading branch information
Showing
67 changed files
with
1,133 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[CmdletBinding()] | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
$Settings | ||
) | ||
|
||
Enter-Build { | ||
$exampleDir = Join-Path $Settings.examples "SyncOverAsync" | ||
} | ||
|
||
task Default Build, Run | ||
|
||
task Build { | ||
exec { dotnet restore $exampleDir } | ||
exec { dotnet build --configuration Release $exampleDir } | ||
} | ||
|
||
task Run { | ||
$apps = @("Demo.ServerAspNetCore", "Demo.ServerSelfHost") | ||
foreach ($app in $apps) { | ||
Write-Output "=== exec $app ===" | ||
|
||
$entryPoint = Join-Path $exampleDir "$app/bin/Release/net6.0/$app.dll" | ||
exec { dotnet $entryPoint } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[CmdletBinding()] | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
$Settings | ||
) | ||
|
||
task Default Clean, Build, Run | ||
|
||
task Clean { | ||
Remove-DirectoryRecurse -Path (Join-Path $settings.examples "SyncOverAsync") -Filters "bin", "obj" | ||
} | ||
|
||
task Build { | ||
Build-ExampleInContainer ` | ||
-Sources $settings.sources ` | ||
-Examples $settings.examples ` | ||
-Packages $settings.buildOut ` | ||
-ExampleName "SyncOverAsync" ` | ||
-DotNet "net6.0" | ||
} | ||
|
||
task Run { | ||
Invoke-ExampleInContainer ` | ||
-Example (Join-Path $settings.examples "SyncOverAsync") ` | ||
-DotNet "net6.0" ` | ||
-Apps "Demo.ServerAspNetCore", "Demo.ServerSelfHost" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
"Dependencies": [ | ||
{ | ||
"Name": "Grpc.Net.Common", | ||
"Version": "2.41.0" | ||
"Version": "2.42.0" | ||
} | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...uget.org/grpc.net.common/2.41.0/readme.md → ...uget.org/grpc.net.common/2.42.0/readme.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Grpc.Core" Version="$(GrpcCoreVersion)" /> | ||
<PackageReference Include="ServiceModel.Grpc" Version="$(ServiceModelGrpcVersion)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Contract\Contract.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Contract; | ||
using Grpc.Core; | ||
using ServiceModel.Grpc.Client; | ||
|
||
namespace Client | ||
{ | ||
public sealed class ClientCalls | ||
{ | ||
private readonly IClientFactory _clientFactory; | ||
private readonly Channel _channel; | ||
|
||
public ClientCalls(int serverPort) | ||
{ | ||
_clientFactory = new ClientFactory(); | ||
_channel = new Channel("localhost", serverPort, ChannelCredentials.Insecure); | ||
} | ||
|
||
public void RunSync() | ||
{ | ||
var personService = _clientFactory.CreateClient<IPersonService>(_channel); | ||
|
||
Console.WriteLine("Invoke Create"); | ||
|
||
var person = personService.Create("John X", DateTime.Today.AddYears(-20)); | ||
|
||
Console.WriteLine(" Name: {0}", person.Name); | ||
Console.WriteLine(" BirthDay: {0}", person.BirthDay); | ||
|
||
Console.WriteLine("Invoke Update"); | ||
|
||
person = personService.Update(person, "John", DateTime.Today.AddYears(-21)); | ||
|
||
Console.WriteLine(" Name: {0}", person.Name); | ||
Console.WriteLine(" BirthDay: {0}", person.BirthDay); | ||
} | ||
|
||
public async Task RunAsync() | ||
{ | ||
var personService = _clientFactory.CreateClient<IPersonService>(_channel); | ||
|
||
Console.WriteLine("Invoke CreateAsync"); | ||
|
||
var person = await personService.CreateAsync("John X", DateTime.Today.AddYears(-20)); | ||
|
||
Console.WriteLine(" Name: {0}", person.Name); | ||
Console.WriteLine(" BirthDay: {0}", person.BirthDay); | ||
|
||
Console.WriteLine("Invoke UpdateAsync"); | ||
|
||
person = await personService.UpdateAsync(person, "John", DateTime.Today.AddYears(-21), default); | ||
|
||
Console.WriteLine(" Name: {0}", person.Name); | ||
Console.WriteLine(" BirthDay: {0}", person.BirthDay); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="System.ServiceModel.Primitives" Version="4.7.0" /> | ||
<PackageReference Include="ServiceModel.Grpc" Version="$(ServiceModelGrpcVersion)" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.ServiceModel; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace Contract | ||
{ | ||
[ServiceContract] | ||
public interface IPersonService | ||
{ | ||
// blocking unary call Create | ||
Person Create(string name, DateTime birthDay); | ||
|
||
// async unary call Create | ||
[OperationContract] | ||
Task<Person> CreateAsync(string name, DateTime birthDay); | ||
|
||
// blocking unary call Update | ||
Person Update(Person person, string newName, DateTime newBirthDay); | ||
|
||
// async unary call Update | ||
[OperationContract] | ||
ValueTask<Person> UpdateAsync(Person person, string newName, DateTime newBirthDay, CancellationToken token); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Contract | ||
{ | ||
[DataContract] | ||
public class Person | ||
{ | ||
[DataMember] | ||
public string Name { get; set; } | ||
|
||
[DataMember] | ||
public DateTime BirthDay { get; set; } | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Examples/SyncOverAsync/Demo.ServerAspNetCore/Demo.ServerAspNetCore.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="ServiceModel.Grpc.AspNetCore" Version="$(ServiceModelGrpcVersion)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Client\Client.csproj" /> | ||
<ProjectReference Include="..\Service\Service.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
9 changes: 9 additions & 0 deletions
9
Examples/SyncOverAsync/Demo.ServerAspNetCore/Demo.ServerAspNetCore.csproj.user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<ActiveDebugProfile>ServerAspNetCore</ActiveDebugProfile> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | ||
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor> | ||
</PropertyGroup> | ||
</Project> |
Oops, something went wrong.