Exemple #1
0
        public static IServiceCollection AddQueryProcessor(this IServiceCollection services, object processor)
        {
            var processorInterfaces = Types.QueryProcessorTypes;

            var descriptor = ProcessorDescriptor.Build(processor, processorInterfaces);

            services.Add(descriptor);

            UpsertPipeline(services, descriptor.ServiceType, ServiceLifetime.Singleton);

            return(services);
        }
Exemple #2
0
        public static IServiceCollection AddCommandBehaviour(this IServiceCollection services, object behaviour)
        {
            var processorInterfaces = Types.CommandProcessorTypes;

            var descriptor = ProcessorDescriptor.Build(behaviour, processorInterfaces);

            services.Add(descriptor);

            UpsertPipeline(services, descriptor.ServiceType, ServiceLifetime.Singleton);

            return(services);
        }
Exemple #3
0
        public static IServiceCollection AddQueryProcessor <TProcessor>(this IServiceCollection services,
                                                                        ServiceLifetime lifetime = ServiceLifetime.Singleton)
        {
            var implementation      = typeof(TProcessor);
            var processorInterfaces = Types.QueryProcessorTypes;

            var descriptor = ProcessorDescriptor.Build(implementation, processorInterfaces, lifetime);

            services.Add(descriptor);

            UpsertPipeline(services, descriptor.ServiceType, lifetime);

            return(services);
        }