Skip to content

Instantly share code, notes, and snippets.

@pedroreys
Created December 23, 2016 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedroreys/42697e0812f5df6f4ca3831262f73f60 to your computer and use it in GitHub Desktop.
Save pedroreys/42697e0812f5df6f4ca3831262f73f60 to your computer and use it in GitHub Desktop.
public class PurchaseItemValidator : IValidator<PurchaseItem>
{
private IEnumerable<IValidationRule<PurchaseItem>> _rules;
public PurchaseItemValidator(IEnumerable<IValidationRule<PurchaseItem>> rules)
{
_rules = rules;
}
public IEnumerable<ValidationResult> Validate(PurchaseItem command)
{
return _rules.Select(r => r.Validate(command));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment