With hbm.xml:

<property name="PropertyName" type="String" column="`COLUMN_NAME`" 
length="50" not-null="false" unique="true" check="len(column_name) > 1" />

Or by code:

Property(x => x.PropertyName, m =>
{
    m.Column(c =>
    {
        c.Name("column_name");
        c.Length(50);
        c.NotNullabl(false);
        c.Check("len(column_name) > 1");
        c.Unique(true);
    });
});

RP


On Wednesday, November 6, 2013 7:11:50 PM UTC, epitka wrote:
>
> Is there a way to tell NH that mapping is such that there should be unique 
> constraint on the column, except null values? I now you can constrain it, 
> but currently that includes nulls also. I can get it done in db manually 
> but I need a way for  nh to generate such db script. 
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to