diff --git a/src/Grpc.Extension/Grpc.Extension.xml b/src/Grpc.Extension/Grpc.Extension.xml index 69cb3f0..458b5fd 100644 --- a/src/Grpc.Extension/Grpc.Extension.xml +++ b/src/Grpc.Extension/Grpc.Extension.xml @@ -356,6 +356,11 @@ 默认错误码 + + + ChannelOption + + JaegerOptions @@ -471,13 +476,6 @@ - - - 配制ChannelOptions - - - - 构建Server diff --git a/src/Grpc.Extension/Options/GrpcServerOptions.cs b/src/Grpc.Extension/Options/GrpcServerOptions.cs index 5b4ea61..ee7ce0f 100644 --- a/src/Grpc.Extension/Options/GrpcServerOptions.cs +++ b/src/Grpc.Extension/Options/GrpcServerOptions.cs @@ -1,4 +1,5 @@ -using Grpc.Extension.Abstract.Model; +using Grpc.Core; +using Grpc.Extension.Abstract.Model; using System; using System.Collections.Generic; using System.Text; @@ -49,6 +50,11 @@ public int DefaultErrorCode get { return GrpcErrorCode.DefaultErrorCode; } set { GrpcErrorCode.DefaultErrorCode = value; } } + + /// + /// ChannelOption + /// + public IEnumerable ChannelOptions { get; set; } } } diff --git a/src/Grpc.Extension/ServerBuilder.cs b/src/Grpc.Extension/ServerBuilder.cs index b4996bc..8c0a43c 100644 --- a/src/Grpc.Extension/ServerBuilder.cs +++ b/src/Grpc.Extension/ServerBuilder.cs @@ -27,7 +27,6 @@ public class ServerBuilder private readonly List _interceptors = new List(); private readonly List _serviceDefinitions = new List(); private readonly List _grpcServices = new List(); - private IEnumerable _channelOptions; /// /// ServerBuilder @@ -225,17 +224,6 @@ private void CheckUseJaeger() if (tracer != null) GlobalTracer.Register(tracer); } - /// - /// 配制ChannelOptions - /// - /// - /// - public ServerBuilder UseChannelOptions(IEnumerable channelOptions) - { - _channelOptions = channelOptions; - return this; - } - /// /// 构建Server /// @@ -246,7 +234,7 @@ public Server Build() if (string.IsNullOrWhiteSpace(GrpcServerOptions.Instance.ServiceAddress)) throw new ArgumentException(@"GrpcServer:ServiceAddress is null"); - Server server = new Server(_channelOptions); + Server server = new Server(GrpcServerOptions.Instance.ChannelOptions); //使用拦截器 var serviceDefinitions = ApplyInterceptor(_serviceDefinitions, _interceptors); //添加服务定义