public HomeController(ILogger <HomeController> logger, IAlipayClient client, IOptions <AlipayOptions> optionsAccessor, ServerDiagnosticInterceptor interceptor) { _logger = logger; _client = client; _optionsAccessor = optionsAccessor; _Interceptor = interceptor ?? throw new ArgumentNullException(nameof(interceptor));; }
public void UseGrpcTrack() { var services = new ServiceCollection(); var provider = services.BuildServiceProvider(); var p = provider.GetRequiredService <ServerDiagnosticInterceptor>(); if (p != null) { Interceptor = p; } //var interceptor = provider.GetRequiredService<ServerDiagnosticInterceptor>(); if (Interceptor != null) { // Interceptor = interceptor; } //services.AddSingleton((container) => //{ // var logger = container.GetRequiredService<ServerDiagnosticInterceptor>(); // return Interceptor=logger; //}); }