I'm using MVC Foolproof validation (https://foolproof.codeplex.com/) and I've realised that it doesn't allow for multiple targets on the attributes. For example, I'd like to have a property that is required to be "GreaterThanOrEqualTo" two other properties, but the Foolproof attributes are not set up for multiple usage. So this:
public class RecordResultViewModel
{
[LessThanOrEqualTo("EndDate", ErrorMessage = "The start date cannot be after the end date.")]
[LessThanOrEqualTo("EnrolmentEndDate", ErrorMessage = "The start date cannot be before the enrolment end date.")]
public DateTime? StartDate { get; set; }
[GreaterThanOrEqualTo("StartDate", ErrorMessage = "The end date cannot be before the start date.")]
[GreaterThanOrEqualTo("EnrolmentStartDate", ErrorMessage = "The end date cannot be before the enrolment start date.")]
public DateTime? EndDate { get; set; }
public DateTime EnrolmentStartDate { get; set; }
public DateTime EnrolmentEndDate { get; set; }
}
I can't think of any way around this and I've noticed that the project on Codeplex hasn't been maintained since 2012, so I really need an alternative solution that supports multiple same attributes and also supports ALL of the same validation attributes as Foolproof.