DateTime字段的RangeAttribute

时间:2013-07-15 04:37:21

标签: silverlight wcf-ria-services

我正在使用WCF RIA服务。我面临DateTime字段需要RangeAttribute。 RangeAttribute是否支持DateTime字段?或者我是否需要应用自己的CustomAttribute?

1 个答案:

答案 0 :(得分:1)

我找到了答案。可以像这样使用DateTime的Range属性:

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