.Net object validation frameworks

2020-07-22 16:48发布

问题:

I'm working on an ASP.NET project using MVP architecture. We would like to use an object validation framework in the domain, but are not that familiar with available frameworks other than the Castle.Components.Validator namespace.

Does anyone have experience with any other light-weight object validation frameworks. If not, what approach do you use to validate in the domain (no ASP.NET validator control answers please)?

回答1:

Validation Application Block in the Enterprise Library
.NET Validation Framework on CodePlex
EViL - Entity Validation Library on CodePlex
Validation Everywhere on CodePlex



回答2:

I like the easy approach of the Fluent Validation framework. You find it on codeplex at:

http://fluentvalidation.codeplex.com/

You can gain the separation between entities and validators that you cannot get with Annotations (e.g.: Enterprise Library).

Hope it helps



回答3:

I'm not very familiar with the MVP pattern, but this guy seems to know what he's doing. Here's how he handles validation with MVP.