views:

2152

answers:

4

I am looking for validation framework and while I am already using NHibernate I am thinking of using NHibernate.validator from contrib project however I also look at MS Validation Block which seem to be robust but i am not yet get into detail of each one yet so I wonder has anyone had step into these two frameworks and how is the experience like?

A: 

How about D) None of the above. I remember evaluating this last year and decided on going with Spring.NET's validation framework.

If your using NHibernate your probably want to use Spring.NET's facilities for using NHibernate as well.

DanielHonig
A: 

For the most part I would say that Spring.NET is pretty independent. Meaning it should not force you to re-architect. You can use as much or as little as you want. It should be pretty easy to write an object that you can inject into classes needing validation using spring. You would then wire this object up in castle to take the name of the "Validation Group" or "Validators" you needed and then have spring inject the validators into that object where your form/business object/service would then use the validators.

Here is a link to the doc,Validation is section 12:

http://www.springframework.net/docs/1.2.0-M1/reference/html/index.html

Are you just using Castle or are you using Monorail?

DanielHonig
+7  A: 

NHibernate Validator does not require you to use NHibernate for persistence. Usage can be as simple as:

var engine = new ValidatorEngine();
InvalidValue[] errors = engine.Validate(someModelObjectWithAttributes);

foreach(var error in errors)
{
    Console.WriteLine(error.Message);
}

Of course it can hook into NHibernate and prevent persistence of invalid objects, but you may use it to validate non-persistent objects as well.

mookid8000