Search code examples
silverlightwcf-ria-services

RangeAttribute for DateTime field


I'm using WCF RIA Services. I'm faced with need of RangeAttribute for DateTime field. Does RangeAttribute supports DateTime fields? Or do i need to apply own CustomAttribute?


Solution

  • I've found an answer. It's possible to use Range attrubute for DateTime like this:

    [Range(typeof(DateTime), "1-Jan-1910", "1-Jan-2060", ErrorMessage = "Неверный формат даты")]
    public virtual System.DateTime IssueDate