Beispiel #1
0
        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);
        }
Beispiel #2
0
 public AspNetCoreServiceMethodBinder(
     ServiceMethodProviderContext <TService> context,
     IMarshallerFactory marshallerFactory,
     ServiceMethodFilterRegistration filterRegistration,
     bool requiresGrpcMarker)
 {
     _context            = context;
     _filterRegistration = filterRegistration;
     _requiresGrpcMarker = requiresGrpcMarker;
     MarshallerFactory   = marshallerFactory;
 }
Beispiel #3
0
 public SelfHostServiceMethodBinder(
     IMarshallerFactory marshallerFactory,
     Func <TService> serviceFactory,
     ServiceMethodFilterRegistration filterRegistration,
     ServerServiceDefinition.Builder builder)
 {
     MarshallerFactory   = marshallerFactory;
     _serviceFactory     = serviceFactory;
     _filterRegistration = filterRegistration;
     _builder            = builder;
 }