Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validation Block vs Nhibernate.Validator

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?

like image 274
c.sokun Avatar asked Sep 30 '08 16:09

c.sokun


1 Answers

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.

like image 70
mookid8000 Avatar answered Oct 17 '22 08:10

mookid8000