http://fabiomaulo.blogspot.com/2009/10/nhibernatevalidator-nhibernate.html

<http://fabiomaulo.blogspot.com/2009/10/nhibernatevalidator-nhibernate.html>The
whole series is:
http://fabiomaulo.blogspot.com/search/label/Validator

2010/2/13 ilie <[email protected]>

> Hi,
>
>  I have an issue in applying validation against my data. I am able to
> create tables, manipulate entities using NHibernate but i could not
> validate them...
>
>  I was trying to do this using xml configuration. I followed this
> steps:
>
>  1. i applied constraints to my entities something like:
>
> [NotNullNotEmpty]
> [Length(25)]
> public virtual String StudentName { get; set; }
>
> 2. i create an nhvalidator.cfg.xml file on root if my project having
> this content:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <nhv-configuration xmlns="urn:nhv-configuration-1.0">
>  <property name="apply_to_ddl">true</property>
>  <property name="autoregister_listeners">true</property>
>  <property name="default_validator_mode">UseAttribute</property>
>  <mapping assembly="NHibernate.Validator.Demo.Model"/>
> </nhv-configuration>
>
> 3. configure settings
>
>    [TestFixture]
>    class GenerateSchema_Fixture
>    {
>        [Test]
>        public void Can_generate_schema()
>        {
>            var cfg = new Configuration();
>            cfg.Configure();
>
>            ValidatorEngine engine = new ValidatorEngine();
>            engine.Configure();
>
>            cfg.AddAssembly(typeof(Student).Assembly);
>
>            new SchemaExport(cfg).Execute(false, true, false);
>        }
>    }
>
> All things goes right, tables are create on SqlServer  and so on...
> only issue is validation part(tables are createed on SqlServer using
> default values for columns, regardless my validation
> constraints)... .I am not sure if it is right too call validation
> configuration after hibernate configuration in the same test method...
> I am confused were to call it, and if my  steps in configure it ar
> right...
>
> Please if you have an idea give me an hand...
>
> Thanks
>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>


-- 
Fabio Maulo

-- 
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