-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Description
Code is worth a thousand words.
public record CreateOrderCommand(CreateOrderDto Dto, bool ValidateOnly)
: ICommand<long, OrderError>, IValidatable
{
public IEnumerable<ValidationError>? Validate()
{
ICollection<ValidationResult>? results = null;
if (!Validator.TryValidateObject(Dto, new ValidationContext(Dto), results, true))
{
return results?.Select(r => new ValidationError(r.ErrorMessage, r.MemberNames.First()));
}
return null;
}
}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request