public void OnServiceMethodDiscovery(ServiceMethodProviderContext <TService> context) { var serviceType = typeof(TService); if (ServiceContract.IsNativeGrpcService(serviceType)) { if (_logger.IsEnabled(LogLevel.Debug)) { _logger.LogDebug("Ignore service {0} binding: native grpc service.", serviceType.FullName); } return; } var filterContext = new ServiceMethodFilterRegistration(_serviceProvider); filterContext.Add(_rootConfiguration.GetFilters()); filterContext.Add(_serviceConfiguration.GetFilters()); var marshallerFactory = (_serviceConfiguration.MarshallerFactory ?? _rootConfiguration.DefaultMarshallerFactory).ThisOrDefault(); var serviceBinder = new AspNetCoreServiceMethodBinder <TService>( context, marshallerFactory, filterContext, _rootConfiguration.IsApiDescriptionRequested); CreateEndpointBinder().Bind(serviceBinder); }
private static void ValidateServiceType(Type serviceType) { if (ServiceContract.IsNativeGrpcService(serviceType)) { throw new InvalidOperationException("{0} is native grpc service.".FormatWith(serviceType.FullName)); } }
public void OnServiceMethodDiscovery(ServiceMethodProviderContext <TService> context) { var serviceType = typeof(TService); if (ServiceContract.IsNativeGrpcService(serviceType)) { _logger.LogDebug("Ignore service {0} binding: native grpc service.", serviceType.FullName); return; } var marshallerFactory = (_serviceConfiguration.MarshallerFactory ?? _rootConfiguration.DefaultMarshallerFactory).ThisOrDefault(); var serviceBinder = new AspNetCoreServiceMethodBinder <TService>(context, marshallerFactory); CreateEndpointBinder().Bind(serviceBinder); }