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
});
}