Hi!

How can I set up NHV to use attributes?

I'm trying this but it doesn't work.

            var configuration = new FluentConfiguration();

 
configuration.Register(classes).SetDefaultValidatorMode(ValidatorMode.UseAttribute);
 //
classes is IEnumerable<Type> containing my domain that is decorated
with NHV attributes.

            var engine = new ValidatorEngine();
            engine.Configure(configuration);

I have it working with ValidationDef's.

Next,

According to < http://ayende.com/blog/3990/nhibernate-validator >, NHV
can integrate with NH so to map the validation rules to the db schema.

Eg having this:

    public class CustomerValidationDef : ValidationDef<Customer>
    {
        public CustomerValidationDef()
        {

            Define(c =>
c.PIN).NotNullableAndNotEmpty().WithMessage("PIN must be set.");
            Define(c => c.PIN).LengthBetween(11, 11).WithMessage("PIN
must have eleven digits.");

        }
    }

would result in having this mapping

   <property name="PIN" length="11" not-null="true" unique="true" />

To the best of my knowledge this works only with attributes and xml
validation definitions.
If this is true, is there an effort to make this integration work with
ValidationDef's? Is this possible to implement?

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to