Exemple #1
0
        public NotificationPipelineFactoryShould()
        {
            _engine  = new Mock <IDependencyEngine>();
            _factory = new NotificationPipelineFactory();

            _pipelineType  = typeof(INotificationPipeline <Notification>);
            _processorType = typeof(INotificationProcessor <Notification>);
        }
Exemple #2
0
        internal static void UpsertPipeline(IServiceCollection services, Type contract, ServiceLifetime lifetime)
        {
            var notificationType = contract.GenericTypeArguments[0];
            var pipelineType     = Types.NotificationPipeline.MakeGenericType(notificationType);

            if (services.RemoveLessLifetimeService(pipelineType, lifetime, true))
            {
                services.Add(new ServiceDescriptor(
                                 pipelineType,
                                 NotificationPipelineFactory.GetActivator(notificationType),
                                 lifetime));
            }
        }