CQRSMicroservices.Articles.ArticleAggregateRoot.Handle C# (CSharp) Метод

Handle() приватный Метод

private Handle ( CreateArticleCommand command ) : void
command CreateArticleCommand
Результат void
    private void Handle(CreateArticleCommand command)
    {
      if(command.Price <= 0)
      {
        throw new CommandValidationException("Price should be above 0.");
      }
      if(string.IsNullOrEmpty(command.Description) || command.Description.Length > 50)
      {
        throw new CommandValidationException("Description is mandatory, and cannot be longer then 50 characters.");
      }

      RaiseEvent(new ArticleCreatedEvent
      {
        ArticleId = command.ArticleId,
        Description = command.Description,
        Price = command.Price
      });
    }

Same methods

ArticleAggregateRoot::Handle ( MakeArticleAvailableCommand command ) : void
ArticleAggregateRoot::Handle ( MakeArticleUnavailableCommand command ) : void
ArticleAggregateRoot::Handle ( SellArticleCommand command ) : void