Should I abstract the validation framework from Domain layer?

Just like the repository abstraction? Well, I see a few problems with your design even if you shield your domain from the framework by declaring an IUserValidator interface. At first, it seems like if that would lead to the same abstraction strategy as for the Repository and other infrastructure concerns, but there’s a huge difference … Read more

ViewModel validation for a List

If you are using Data Annotations to perform validation you might need a custom attribute: public class EnsureOneElementAttribute : ValidationAttribute { public override bool IsValid(object value) { var list = value as IList; if (list != null) { return list.Count > 0; } return false; } } and then: [EnsureOneElement(ErrorMessage = “At least a person … Read more