/// <summary> /// Perform initial setup of commands library by finding all commands handlers in <paramref name="assemblies" /> /// and registering them in <paramref name="container" /> with specified <paramref name="lifestyle" />. /// </summary> /// <param name="container">Container that will be used for registration. If null the inner container will be created.</param> /// <param name="lifestyle">Default lifestyle for command handlers. If null the transient lifestyle will be used.</param> /// <param name="verifyAllCommandsHasHandlers"> /// If true will throws <see cref="CommandHandlerNotFoundException" /> for any /// command found without appropriate command handler. /// </param> /// <param name="assemblies"> /// A list of assemblies to scan for <see cref="ICommandHandler{TCommand,TResult}" /> /// implementations. If null or empty the calling assembly will be used. /// </param> public static void Setup(Container container = null, Lifestyle lifestyle = null, bool verifyAllCommandsHasHandlers = true, params Assembly[] assemblies) { Container = container ?? new Container { Options = { AllowOverridingRegistrations = true } }; defaultLifestyle = lifestyle ?? Lifestyle.Transient; if (assemblies == null || assemblies.Length == 0) { assemblies = new[] { Assembly.GetCallingAssembly() } } ; var handler_factory = new SimpleInjectorCommandHandlerFactory(Container); Container.RegisterInstance(handler_factory); CommandsProcessor = new CommandsProcessor(handler_factory); Container.RegisterInstance(CommandsProcessor); RegisterAllCommandHandlers(Container, lifestyle, verifyAllCommandsHasHandlers, assemblies); }
public ScheduledTask ( ICommandsProcessor processor ) { _processor = processor ?? throw new ArgumentNullException(nameof(processor)); }
public SchedulerService( ICommandsProcessor processor, IScheduleRepository scheduleRepository ) { _processor = processor ?? throw new ArgumentNullException(nameof(processor)); _scheduleRepository = scheduleRepository ?? throw new ArgumentNullException(nameof(scheduleRepository)); }
public CheckRegistrator ( ICommandsProcessor checksProcessor, ISchedulerService scheduler ) { _checksProcessor = checksProcessor ?? throw new ArgumentNullException(nameof(checksProcessor)); _scheduler = scheduler ?? throw new ArgumentNullException(nameof(scheduler)); }
public MonitorController ( ICommandsProcessor commandsProcessor, IMediator mediator ) { _commandsProcessor = commandsProcessor ?? throw new ArgumentNullException(nameof(commandsProcessor)); _mediator = mediator ?? throw new ArgumentNullException(nameof(mediator)); }
// Constructors public Engine(IReader reader, IWriter writer, ICommandsProcessor commandsProcessor) { this.reader = reader; this.writer = writer; this.commandsProcessor = commandsProcessor; this.Seasons = new List <ISeason>(); this.Students = new List <IStudent>(); this.Trainers = new List <ITrainer>(); }
public static IEnumerable <Type> GetAllAsyncDecoratorsGenericTypes <TCommand> (this ICommandsProcessor commands) where TCommand : IAsyncCommand { return(commands.GetAllAsyncDecoratorsTypes <TCommand> ().Select(x => x.GetGenericTypeDefinition())); }
public static IEnumerable <Type> GetAllDecoratorsTypes <TCommand> (this ICommandsProcessor commands) where TCommand : ICommand { return(commands.GetAllDecorators <TCommand> ().Select(x => x.GetType())); }
public BooksController(ICommandsProcessor commandProcessor, IQueriesProcessor queriesProcessor) { _commandProcessor = commandProcessor; _queriesProcessor = queriesProcessor; }