Closed GoogleCodeExporter closed 9 years ago
Here is a simple patch for the NHibernateSession class with support for
NHibernate.Validator. I created an overload for the init method that includes
support
for a validator configuration file (similar to the standard nhib config file).
This
is a tad different than the version that I am using, in that I also extended my
version of the class to handle a collection of SessionFactories for multiple
dbs. I
am still testing the multiple db support, so I have not included those changes
in
this patch.
Once this in place, you have to add a reference to nhibernate.validator.dll in
your
web and core projects to gain access to the validation attributes (core) and the
InvalidStateException (web). The process of registering validation errors with
the
ModelState collection of the controller is a bit of a manual process, but I
imagine
something could be done with a controller base class or something to make things
easier. I'm manually trapping the InvalidStateException currently (similar to
Gu's
post on preview 5).
Original comment by russell....@gmail.com
on 10 Oct 2008 at 6:07
Attachments:
Great patch Russell...thanks for the submission, it has been added to the trunk.
Original comment by wmccaffe...@gmail.com
on 22 Oct 2008 at 4:55
Original issue reported on code.google.com by
wmccaffe...@gmail.com
on 10 Oct 2008 at 4:21