コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }