public CreateResponseCommand(ICreateCommand <T> command, IMessageSender sender, Guid CorrelationId, MessageVerb verb) { _command = command; _sender = sender; _correlationId = CorrelationId; _verb = verb; }
public ConsumerBase( ICreateCommand <TMessage> createCommand, ConnectionFactory connectionFactory) : base(connectionFactory) { _createCommand = createCommand; }
public void UseSqlServer() { this._createCommand = new SqlServerCreateCommand(); this._updateCommand = new SqlServerUpdateCommand(); this._findCommand = new SqlServerFindCommand(); this._deleteCommand = new SqlServerDeleteCommand(); }
public DataMigrator( ILogger <DataMigrator <T> > logger, IKeyResolver <T> keyResolver, IGetAllQuery <T> sourceQuery, ICreateCommand <T> targetCommand, DataMigratorOptions options = null) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (keyResolver == null) { throw new ArgumentNullException(nameof(keyResolver)); } if (sourceQuery == null) { throw new ArgumentNullException(nameof(sourceQuery)); } if (targetCommand == null) { throw new ArgumentNullException(nameof(targetCommand)); } log = logger; this.keyResolver = keyResolver; this.sourceQuery = sourceQuery; this.targetCommand = targetCommand; this.options = options ?? new DataMigratorOptions(); }
public async Task <bool> Handle(ICreateCommand <T> command) { await _keyGenerator.Generate(command.NewEntity()); await Collection.InsertOneAsync(command.NewEntity()); return(true); }
public TestingController( ICreateCommand <Article> createQuery1, ICreateCommand <Category> createQuery2, IUnitOfWork unitOfWork) { this.createQuery1 = createQuery1; this.createQuery2 = createQuery2; this.unitOfWork = (UnitOfWork)unitOfWork; }
public UserService(IQuery <UserData, User> query, ICreateCommand <UserData> createCommand, IUpdateCommand <UserData> updateCommand, IDeleteCommand <UserData> deleteCommand) { _query = query; _createCommand = createCommand; _updateCommand = updateCommand; _deleteCommand = deleteCommand; }
public RoleService(IQuery <RoleData, Role> query, ICreateCommand <RoleData> createCommand, IUpdateCommand <RoleData> updateCommand, IDeleteCommand <RoleData> deleteCommand) { _query = query; _createCommand = createCommand; _updateCommand = updateCommand; _deleteCommand = deleteCommand; }
public MessageConsumer( ICreateCommand <SendMessageRequestDTO> createCommand, ConnectionFactory connectionFactory) : base(createCommand, connectionFactory) { try { var consumer = new AsyncEventingBasicConsumer(Channel); consumer.Received += OnEventReceived; Channel.BasicConsume(queue: RabbitMqQueueName, autoAck: false, consumer: consumer); } catch (Exception ex) { throw new Exception("Error while consuming message", ex); } }
public virtual async Task <TEntity> Handle(ICreateCommand <TEntity> request, CancellationToken cancellationToken) { ConstructorInfo ctor = typeof(TEntity).GetConstructors() .First(c => c.IsPublic); ObjectActivator <TEntity> createdActivator = GetActivator <TEntity>(ctor); TEntity newEntity = createdActivator(Guid.NewGuid(), request); EntityEntry <TEntity> createResult = _arpaContext.Add(newEntity); if (await _arpaContext.SaveChangesAsync(cancellationToken) > 0) { return(createResult.Entity); } throw new Exception($"Problem creating {newEntity.GetType().Name}"); }
public IActionResult Post([FromBody] CreateUserDto dto, [FromServices] ICreateCommand command) { _executor.ExecuteCommand(command, dto); return(StatusCode(StatusCodes.Status201Created)); }
public void Handle(ICreateCommand command) { throw new System.NotImplementedException(); }