使用Enterprise Library 4.1的动态DateTimeRangeValidator?

问题描述:

我想添加一个范围 - 365天和+ 365天,但它似乎在EL 4.1中使用此属性只接受一个特殊的ISO格式的字符串...因此我不能简单地添加一个普通的字符串验证程序。使用Enterprise Library 4.1的动态DateTimeRangeValidator?

<DateTimeRangeValidator(DateTime.Now.AddDays(2), DateTime.Now.AddDays(4))> _ 

我想要做类似上面的东西 - FYI

有谁知道如何可以强制此属性接受这个ISO格式的字符串瓦特/手动编码这个值?

我想你想要的是一个“RelativeDateTimeValidator”参见CodeProject article here

更新:CP链接看起来死了,here is the MSDN link