Which validation framework is better? - asp.net-mvc

Does anyone have any recommendations for either of these validation ASP.Net MVC Validation frameworks?
xVal: http://xval.codeplex.com/
FluentValidation: http://fluentvalidation.codeplex.com/documentation
NHibernate.Validator
DataAnnotations
by the way: my project use sharp-architecture

This is a personal opinion, xVal and FluentValidation have there pro's and con's. NHibernate.Validator is lighter weight, and functions better if you are already using NHibernate as your schema loader. Then the obvious DataAnnotations is built into ASP.NET which is always something hard to resist.
Personally I use xVal for the built in jQuery validation.

If you're using MVC 2, DataAnnotations and an xVal-like client side validation is built in.
If you're using MVC 1, you can use xVal alongside DataAnnotations. In fact, xVal by itself won't do anything for you--it's just a technology to link a server-side validation framework like DataAnnotations to a client-side validation framework like jQuery validation.
We're using DataAnnotations + xVal on a project and it's worked out all right. We needed to make some changes to the DataAnnotationsModelBinder.

Related

NHibernate Validator and ASP.NET MVC 4

We're looking at upgrading a large-scale project currently implemented using ASP.NET MVC 2 with xVal providing the glue between NHibernate Validator and client-side validation.
When I was looking for resources on using the new "unobtrusive" client side validation used in MVC 3/4 with NHibernate Validator, I was only able to locate a single (and nearly 3 year-old) blog post about this.
Has anyone successfully used NHibernate Validator for client-side validation in MVC 3/4? If so, what has your experience been?
Although I don't have any experience directly with NHibernate, FluentValidation (a validation framework worth considering itself) has an MVC 3/4 adapter extension project which would serve as an excellent guide to creating an NHibernate Validator implementation.
So, i've never used NHibernate Validator, but consider to, because NHibernate Validator has a better perfomance than native MVC unobtrusive validator(MVC validator is totaly based on reflection, in case of NHibernate Validator reflection work happens at startup only).
In case of a large-scale project, i think it is better way.

Is xVal obsolete with MVC 2?

Now that built-in validation is supported with MVC 2 framework, should we be using it instead? Are there any advantages that xVal has over MVC 2 validation?
The main reason I ask is that we have a couple MVC sites that use it, and it appears xVal is no longer being maintained/supported. If this is the case, I'd like to start changing our sites over to use MVC 2 validation.
Thanks in advance.
The jQuery validation scripts included with MVC2 are fully supported by Microsoft, so I would prefer them over third-party scripts, especially ones that no one is actively supporting. The xVal Codeplex site clearly lists xVal as only supported with MVC1.0.

Where can I find a decent tutorial/explanation of using Castle Validators with ASP.NET MVC2?

Where can I find a decent tutorial/explanation of using Castle Validators with ASP.NET MVC2?
I want to go with Castle because I'm not fond of the fact that I can't test my POCOs using Data Annotations without copying the logic of grabbing the attributes and calling isValid on all of them. I'm much more fond of the fact that with Castle I can just call IsValid on the ValidatorRunner which I can instantiate in my tests. I might just forget about the built-in mvc2 validation framework and go with xVal. /shrug
These articles/screencast seems to be good:
ASP.NET MVC Auto Model Validation with xVal
Model-based Client-side Validation for ASP.NET MVC
Contact Form with ASP.NET MVC, Castle Validation, & fluentHtml
Hope that helps.

Validation Framework for a WPF app (using MVP) and ASP.NET MVC

I'm looking for a form validation framework that works best in both Windows (WPF using MVP) and Web (ASP.NET MVC).
I'm currently looking at three choices:
Enterprise Library Validation Application Block
http://www.codeplex.com/FluentValidation
http://validationframework.codeplex.com
I like Fluent Validation as it looks a lot cleaner. The others, though, have been around longer.
Any other recommendations?
In MVC apps I've found Fluent Validation very useful for more complex validations. DataAnnotations are often enough for simple validations in MVC.

Why ASP.NET MVC 2 will have its own client-side validation?

I am interested what are possible reasons that ASP.NET MVC 2 will have its own client-side validation instead of merging with xVal validation framework? Has someone from ASP.NET MVC team blogged about it?
They are providing a way to plug in some other library for client-side validation.
Haacked blog:
Client-Side Validation – ASP.NET MVC 2 includes the jQuery validation library to provide client-side validation based on the model’s validation metadata. It is possible to hook in alternative client-side validation libraries by writing an adapter which adapts the client library to the JSON metadata in a manner similar to the xVal validation framework.

Resources