Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark GrpcChannelProvider(GrpcChannelOptions) as Obsolete #734

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/build-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ on:
- '**.md'
- .github/**
- docs/**
- samples/**
pull_request:
branches:
- main
paths-ignore:
- '**.md'
- .github/**
- docs/**
- samples/**

env:
BUILD_CONFIG: Debug
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1066,12 +1066,12 @@ Before creating a channel in your application, you need to initialize the provid
public static void OnRuntimeInitialize()
{
// Initialize gRPC channel provider when the application is loaded.
GrpcChannelProviderHost.Initialize(new DefaultGrpcChannelProvider(new []
GrpcChannelProviderHost.Initialize(new DefaultGrpcChannelProvider(() => new GrpcChannelOptions()
{
// send keepalive ping every 5 second, default is 2 hours
new ChannelOption("grpc.keepalive_time_ms", 5000),
// keepalive ping time out after 5 seconds, default is 20 seconds
new ChannelOption("grpc.keepalive_timeout_ms", 5 * 1000),
HttpHandler = new YetAnotherHttpHandler()
{
Http2Only = true,
},
}));
}
```
Expand Down
6 changes: 0 additions & 6 deletions samples/ChatApp/ChatApp.Shared/ChatApp.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<None Remove="**\package.json" />
<None Remove="**\*.asmdef" />
<None Remove="**\*.meta" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\MagicOnion.Abstractions\MagicOnion.Abstractions.csproj" />
</ItemGroup>
Expand Down
20 changes: 11 additions & 9 deletions samples/ChatApp/ChatApp.Shared/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
prior to .NET 8
<BaseIntermediateOutputPath>.artifacts\obj\</BaseIntermediateOutputPath>
<BaseOutputPath>.artifacts\bin\</BaseOutputPath>
-->

<!-- after .NET 8: https://learn.microsoft.com/en-us/dotnet/core/sdk/artifacts-output -->
<!-- Unity ignores . prefix folder -->
Override the output path of build artifacts.
This is necessary to change the path to one with a dot(.) prefix to hide generated items from Unity.
-->
<PropertyGroup>
<!-- Using .NET 8 and later, use ArtifactsPath property. -->
<!-- https://learn.microsoft.com/en-us/dotnet/core/sdk/artifacts-output -->
<ArtifactsPath>$(MSBuildThisFileDirectory).artifacts</ArtifactsPath>
<!-- Using .NET 7 and ealier, use BaseIntermediateOutputPath and BaseOutputPath property instead. -->
<!-- NOTE: Currently, even if .NET 8 SDK is installed, MessagePack.Generator still requires these properties to be set. -->
<BaseIntermediateOutputPath>.artifacts\obj\</BaseIntermediateOutputPath>
<BaseOutputPath>.artifacts\bin\</BaseOutputPath>
</PropertyGroup>
</Project>
19 changes: 19 additions & 0 deletions samples/ChatApp/ChatApp.Shared/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Hide Unity-specific files from Visual Studio and .NET SDK -->
<ItemGroup>
<None Remove="**\package.json" />
<None Remove="**\*.asmdef" />
<None Remove="**\*.meta" />
</ItemGroup>

<!-- Hide build artifacts from Visual Studio and .NET SDK -->
<ItemGroup>
<None Remove=".artifacts\**\**.*" />
<None Remove="obj\**\*.*;bin\**\*.*" />
<Compile Remove=".artifacts\**\**.*" />
<Compile Remove="bin\**\*.*;obj\**\*.*" />
<EmbeddedResource Remove=".artifacts\**\**.*" />
<EmbeddedResource Remove="bin\**\*.*;obj\**\*.*" />
</ItemGroup>
</Project>
7 changes: 7 additions & 0 deletions samples/ChatApp/ChatApp.Shared/Directory.Build.targets.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public DefaultGrpcChannelProvider(GrpcCCoreChannelOptions channelOptions) : base
public class DefaultGrpcChannelProvider : GrpcNetClientGrpcChannelProvider
{
public DefaultGrpcChannelProvider() : base() {}
public DefaultGrpcChannelProvider(GrpcChannelOptions channelOptions) : base(channelOptions) {}
[Obsolete("Use constructor with a GrpcChannelOptions factory overload instead. If you pass a GrpcChannelOptions directly, HttpClient/HttpHandler may be reused unintentionally.")]
public DefaultGrpcChannelProvider(GrpcChannelOptions channelOptions) : base(channelOptions) { }
public DefaultGrpcChannelProvider(Func<GrpcChannelOptions> channelOptionsFactory) : base(channelOptionsFactory) {}
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ public class GrpcNetClientGrpcChannelProvider : GrpcChannelProviderBase
{
readonly Func<GrpcChannelOptions> defaultChannelOptionsFactory;
public GrpcNetClientGrpcChannelProvider()
: this(new GrpcChannelOptions())
: this(() => new GrpcChannelOptions())
{
}

[Obsolete("Use constructor with a GrpcChannelOptions factory overload instead. If you pass a GrpcChannelOptions directly, HttpClient/HttpHandler may be reused unintentionally.")]
public GrpcNetClientGrpcChannelProvider(GrpcChannelOptions options)
: this(() => options)
{
Expand Down
Loading