Tom Hollander在他的Blog中介绍了作为下一代企业库(开发代号Enterprise Library v3)中的新成员Validation Application Block,Tom Hollander在这里提供了一些实现验证的想法,对于Enterprise Library比较关注的朋友可以一睹为快!
定义验证规则
1.使用配置
沿用Enterprise Library中以前的一贯做法,可以使用Enterprise Library配置工具进行配置验证规则。
2.使用特性
通过加上特性来实现验证,如下面的例子所示:












3.在代码中验证
某些场景下需要在代码中实现验证




在文章中还介绍了验证对象和创建自己的验证器。
详情可以访问:
http://blogs.msdn.com/tomholl/archive/2006/11/27/validation-application-block-revealed.aspx