public async ValueTask <WriteLog> WriteLogAsync(App.Dto.Req.Biz.WriteLog request, CancellationToken cancellationToken = default) { CallOptions = CallOptions.WithCancellationToken(cancellationToken); CallContext = new CallContext(CallOptions, CallContextFlags.IgnoreStreamTermination); try { using (Channel) { IBizAsync client = Channel.CreateGrpcService <IBizAsync>(); return(await client.WriteLogAsync(request, CallContext)); } } catch (Exception ex) { Logger.LogError(GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod()?.Name + " - " + ex.Source + " " + ex.Message + " " + ex.StackTrace); } return(await new ValueTask <WriteLog>()); }
public WriteLog WriteLog(App.Dto.Req.Biz.WriteLog request, CancellationToken cancellationToken = default) { CallOptions = CallOptions.WithCancellationToken(cancellationToken); CallContext = new CallContext(CallOptions, CallContextFlags.IgnoreStreamTermination); WriteLog output = new WriteLog(); try { using (Channel) { IBiz client = Channel.CreateGrpcService <IBiz>(); var result = client.WriteLog(request, CallContext); output = result; } } catch (Exception ex) { Logger.LogError(GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod()?.Name + " - " + ex.Source + " " + ex.Message + " " + ex.StackTrace); } return(output); }