Support DateTime value parameters for date attributes


For all the attributes that validate against a DateTime, provide an overload that accepts an actual DateTime value instead of the string name of a DateTime property. So in addition to:
[ValidateDateOccursAfter("DateTime2", "DateTime1 must be after DateTime2.")]
public DateTime DateTime1 {}
We could also do this:
[ValidateDateOccursAfter(DateTime.Today, "DateTime1 must be after today.")]
public DateTime DateTime1 {}
This needs to happen for the following attributes:
  • ValidateDateOccursAfter
  • ValidateDateOccursBefore
  • ValidateDateOccursOnOrAfter
  • ValidateDateOccursOnOrBefore
Closed Mar 2, 2007 at 2:10 AM by Arcware
Closing this work item because it's not something custom attributes allow us to do.


Arcware wrote Mar 2, 2007 at 2:10 AM

Unfortunately, this is not doable. Attributes only accept simple types, enums, and types as arguments, none of which DateTime fall into.

wrote Mar 2, 2007 at 2:10 AM

wrote Feb 13, 2013 at 8:18 PM

wrote May 16, 2013 at 2:12 AM