Export to GitHub

sharp-architecture - issue #97

Configuration of NHibernate Validator is not saved


Posted on May 6, 2009 by Grumpy Ox

What steps will reproduce the problem? 1. Initialize Nhibernate and NHibernate validator in global.asax 2. In NHibernate validator configuration try to implement CustomMessageInterpolator 3. Try to change validation messages

What is the expected output? What do you see instead? Validation message changes. I see default error messages.

What version of the product are you using? On what operating system? SharpArchitecture_1.0.48.410_RC2. Windows Vista

As I found out it happens because of class Validator. In constructor new instance of validation engine created. This new instance has its own (default) settings, not the same as configured in xml file.

To fix this error I have added static field to NHibernateSession where validator engine is placed after configuration. It fixes the problem.

Comment #1

Posted on Jun 17, 2009 by Helpful Camel

Could you please provide a patch and more details concerning the limitations that you're running into?

Comment #2

Posted on Jun 22, 2009 by Grumpy Ox

Here is a patch that solves the problem.

When you are creating new instance of validatorEngine in the Validator class it is not configured and has default property values.

Attachments

Comment #3

Posted on Jul 15, 2009 by Helpful Camel

Thanks for the fix...that'll work nicely! I've applied it locally and will have it included in the next check-in (which should be 1.0 RTM).

Status: Fixed

Labels:
Type-Defect Priority-Medium