Beispiel #1
0
        public QueryPipelineFactoryShould()
        {
            _engine  = new Mock <IDependencyEngine>();
            _factory = new QueryPipelineFactory();

            _behaviourType     = typeof(IQueryBehaviour <Query, Boo>);
            _pipelineType      = typeof(IQueryPipeline <Query, Boo>);
            _preProcessorType  = typeof(IQueryPreProcessor <Query, Boo>);
            _postProcessorType = typeof(IQueryPostProcessor <Query, Boo>);
        }
Beispiel #2
0
        internal static void UpsertPipeline(IServiceCollection services, Type contract, ServiceLifetime lifetime)
        {
            var queryType    = contract.GenericTypeArguments[0];
            var resultType   = contract.GenericTypeArguments[1];
            var pipelineType = Types.QueryPipeline.MakeGenericType(queryType, resultType);

            if (services.RemoveLessLifetimeService(pipelineType, lifetime, true))
            {
                services.Add(new ServiceDescriptor(
                                 pipelineType,
                                 QueryPipelineFactory.GetActivator(queryType, resultType),
                                 lifetime));
            }
        }