boujnah5207 / sharp-architecture

Automatically exported from code.google.com/p/sharp-architecture
Other
0 stars 0 forks source link

Incorporate NHibernate.Validator into SharpArch library #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
After considering various options, NHibernate.Validator looks to be a solid 
addition to the SharpArch library.

Original issue reported on code.google.com by wmccaffe...@gmail.com on 10 Oct 2008 at 4:21

GoogleCodeExporter commented 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:

GoogleCodeExporter commented 9 years ago
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