/// <summary>
 /// Initializes a new instance of the <see cref="ProcessCommandHandler"/> class.
 /// </summary>
 /// <param name="module">The command handler module.</param>
 /// <param name="idGenerator">The generator for unique identifiers.</param>
 /// <param name="serializer">The JSON serializer.</param>
 /// <param name="imageService">The image service.</param>
 public ProcessCommandHandler(
     ICommandHandlerModule module,
     IIdGenerator idGenerator,
     IDefaultJsonSerializer serializer,
     IImageService imageService)
     : base(module)
 {
     this.idGenerator  = idGenerator ?? throw new ArgumentNullException(nameof(idGenerator));
     this.serializer   = serializer ?? throw new ArgumentNullException(nameof(serializer));
     this.imageService = imageService ?? throw new ArgumentNullException(nameof(imageService));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ResetCommandHandler"/> class.
        /// </summary>
        /// <param name="module">The command handler module.</param>
        /// <param name="configuration">The API configuration.</param>
        /// <param name="serializer">The JSON serializer.</param>
        public ResetCommandHandler(
            ICommandHandlerModule module,
            IApiConfiguration configuration,
            IDefaultJsonSerializer serializer)
            : base(module)
        {
            this.configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
            this.serializer    = serializer ?? throw new ArgumentNullException(nameof(serializer));

            batchSize = configuration.Options.BatchSize > 0 ? configuration.Options.BatchSize : 1000;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateCommandHandler"/> class.
 /// </summary>
 /// <param name="module">The command handler module.</param>
 /// <param name="idGenerator">The generator for unique identifiers.</param>
 /// <param name="constants">The application constants.</param>
 /// <param name="apiConfiguration">The API configuration.</param>
 public CreateCommandHandler(
     ICommandHandlerModule module,
     IIdGenerator idGenerator,
     IApplicationConstants constants,
     IApiConfiguration apiConfiguration)
     : base(module)
 {
     this.idGenerator      = idGenerator ?? throw new ArgumentNullException(nameof(idGenerator));
     this.constants        = constants ?? throw new ArgumentNullException(nameof(constants));
     this.apiConfiguration = apiConfiguration ?? throw new ArgumentNullException(nameof(apiConfiguration));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseCommandRequestHandler{TRequest, TResponse}"/> class.
        /// </summary>
        /// <param name="module">The command handler module.</param>
        public BaseCommandRequestHandler(ICommandHandlerModule module)
        {
            Ensure.ArgumentNotNull(module, nameof(module));

            Audit             = module.Audit ?? throw new UnexpectedNullException("The auditing service cannot be null.");
            Context           = module.Context ?? throw new UnexpectedNullException("The context cannot be null.");
            Events            = module.Events ?? throw new UnexpectedNullException("The events service cannot be null.");
            Gateway           = module.Gateway ?? throw new UnexpectedNullException("The gateway service cannot be null.");
            AuthService       = module.AuthService ?? throw new UnexpectedNullException("The identity service cannot be null.");
            PrincipalProvider = module.PrincipalProvider ?? throw new UnexpectedNullException("The principal provider cannot be null.");
        }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateCommandHandler"/> class.
 /// </summary>
 /// <param name="module">The command handler module.</param>
 /// <param name="idGenerator">The generator for unique identifiers.</param>
 /// <param name="serializer">The JSON serializer.</param>
 /// <param name="factory">The factory.</param>
 public CreateCommandHandler(
     ICommandHandlerModule module,
     IIdGenerator idGenerator,
     IDefaultJsonSerializer serializer,
     IAppInfoFactory factory)
     : base(module)
 {
     this.idGenerator = idGenerator ?? throw new ArgumentNullException(nameof(idGenerator));
     this.serializer  = serializer ?? throw new ArgumentNullException(nameof(serializer));
     this.factory     = factory ?? throw new ArgumentNullException(nameof(factory));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateCommandHandler"/> class.
 /// </summary>
 /// <param name="module">The command handler module.</param>
 /// <param name="idGenerator">The generator for unique identifiers.</param>
 /// <param name="serializer">The JSON serializer.</param>
 /// <param name="mediator">The mediator.</param>
 /// <param name="backgroundService">The background service.</param>
 public CreateCommandHandler(
     ICommandHandlerModule module,
     IIdGenerator idGenerator,
     IDefaultJsonSerializer serializer,
     IMediator mediator,
     IBackgroundService backgroundService)
     : base(module)
 {
     this.idGenerator       = idGenerator ?? throw new ArgumentNullException(nameof(idGenerator));
     this.serializer        = serializer ?? throw new ArgumentNullException(nameof(serializer));
     this.mediator          = mediator ?? throw new ArgumentNullException(nameof(mediator));
     this.backgroundService = backgroundService ?? throw new ArgumentNullException(nameof(backgroundService));
 }
Пример #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DeleteCommandHandler"/> class.
        /// </summary>
        /// <param name="module">The command handler module.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="fileSystemStrategy">The file system strategy.</param>
        public DeleteCommandHandler(
            ICommandHandlerModule module,
            IAppConfiguration configuration,
            IFileSystemStrategy fileSystemStrategy)
            : base(module)
        {
            this.configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));

            if (fileSystemStrategy == null)
            {
                throw new ArgumentNullException(nameof(fileSystemStrategy));
            }

            fileSystem = fileSystemStrategy.Create(configuration.Options.WorkingDirectory);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessCommandHandler"/> class.
        /// </summary>
        /// <param name="module">The command handler module.</param>
        /// <param name="mediator">The mediator.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="archiveReader">The archive reader.</param>
        /// <param name="archiveExtractor">The archive extractor.</param>
        /// <param name="fileSystemStrategy">The file system strategy.</param>
        public ProcessCommandHandler(
            ICommandHandlerModule module,
            IMediator mediator,
            IAppConfiguration configuration,
            IArchiveReader archiveReader,
            IArchiveExtractor archiveExtractor,
            IFileSystemStrategy fileSystemStrategy)
            : base(module)
        {
            this.mediator         = mediator ?? throw new ArgumentNullException(nameof(mediator));
            this.configuration    = configuration ?? throw new ArgumentNullException(nameof(configuration));
            this.archiveReader    = archiveReader ?? throw new ArgumentNullException(nameof(archiveReader));
            this.archiveExtractor = archiveExtractor ?? throw new ArgumentNullException(nameof(archiveExtractor));

            Ensure.ArgumentNotNull(fileSystemStrategy, nameof(fileSystemStrategy));
            fileSystem = fileSystemStrategy.Create(configuration.Options.WorkingDirectory);
        }
Пример #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CreateCommandHandler"/> class.
        /// </summary>
        /// <param name="module">The command handler module.</param>
        /// <param name="idGenerator">The generator for unique identifiers.</param>
        /// <param name="constants">The application constants.</param>
        /// <param name="apiConfiguration">The API configuration.</param>
        /// <param name="appConfiguration">The application configuration.</param>
        /// <param name="fileSystemStrategy">The file system strategy.</param>
        public CreateCommandHandler(
            ICommandHandlerModule module,
            IIdGenerator idGenerator,
            IApplicationConstants constants,
            IApiConfiguration apiConfiguration,
            IAppConfiguration appConfiguration,
            IFileSystemStrategy fileSystemStrategy)
            : base(module)
        {
            this.idGenerator      = idGenerator ?? throw new ArgumentNullException(nameof(idGenerator));
            this.constants        = constants ?? throw new ArgumentNullException(nameof(constants));
            this.apiConfiguration = apiConfiguration ?? throw new ArgumentNullException(nameof(apiConfiguration));
            this.appConfiguration = appConfiguration ?? throw new ArgumentNullException(nameof(appConfiguration));

            if (fileSystemStrategy == null)
            {
                throw new ArgumentNullException(nameof(fileSystemStrategy));
            }

            fileSystem = fileSystemStrategy.Create(appConfiguration.Options.WorkingDirectory);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdateCommandHandler"/> class.
 /// </summary>
 /// <param name="module">The command handler module.</param>
 public UpdateCommandHandler(ICommandHandlerModule module)
     : base(module)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdateCommandHandler"/> class.
 /// </summary>
 /// <param name="module">The command handler module.</param>
 /// <param name="constants">The application constants.</param>
 public UpdateCommandHandler(ICommandHandlerModule module, IApplicationConstants constants)
     : base(module)
 {
     this.constants = constants ?? throw new ArgumentNullException(nameof(constants));
 }
Пример #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeleteCommandHandler"/> class.
 /// </summary>
 /// <param name="module">The command handler module.</param>
 public DeleteCommandHandler(ICommandHandlerModule module)
     : base(module)
 {
 }