public IRequestMetadataProvider Create(IServiceProvider serviceProvider) { var internals = _registrar.CreateAll <IRequestMetadataProvider>(serviceProvider); if (internals.Count == 0) { return(NullRequestMetadataProvider.Instance); } if (internals.Count == 1) { return(internals.First()); } return(new CompositeRequestMetadataProvider(internals)); }
public ITransport Create(IServiceProvider serviceProvider) { var internals = _registrar.CreateAll <ITransport>(serviceProvider); if (internals.Count == 0) { throw new InvalidOperationException("No registered transports"); } if (internals.Count == 1) { return(internals.First()); } return(new CompositeTransport(internals)); }
public IRequestProcessor Create(IServiceProvider serviceProvider) { var middleware = _middleware.CreateAll <IRequestProcessorMiddleware>(serviceProvider); var endware = _endware.CreateOne <IRequestProcessor>(serviceProvider); if (middleware.Count == 0) { return(endware ?? throw new InvalidOperationException("No registered processor")); } if (endware == null) { return(new RequestProcessor(middleware)); } return(new RequestProcessor(middleware, endware)); }