Search code examples
c#winformsnhibernatevalidationnhibernate-validator

Validation for Windows Forms Apps with Nhibernate


I've been using Nhibernate (with fluent nhibernate mapping) in a windows forms application and to do some validation and binding, I've been using NHibernate Validator too and when we try to validate some properties we take this error:

Could not load type 'NHibernate.Bytecode.ProxyFactoryFactoryNotConfiguredException' from assembly 'NHibernate, Version=3.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'.

Can someone help us ?

We don't know what is happening and looking some solution in web we found the nhibernate validator has a bug and we need to fix it or wait the next release, is that true?

Or if someone could recommend another good component to validate/binding on windows forms application with nhibernate, we really appreciate it.

Thanks!


Solution

  • Looks like this is a known bug in the latest (1.3.1) version NHibernate Validator. You can

    • fix it yourself (source are available). Might be relatively easy.
    • use older version of NHibernate (3.1.0 for example should be compatible with your version of NHV).
    • encapsulate validation in your domain objects, which in turn will make them real objects as oppose to simple data containers.