In one of the models I've got something like this:
[Required]
[Display(Name="Date of Birth")]
[Range(typeof(DateTime), DateTime.MinValue.ToString(), DateTime.Today.ToString())]
public DateTime BirthDate { get; set; }
But compiler complains that
Error CS0182 An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
Is there a way I can do it by attribute or do I have to implement it as validation?