nice proposal Luka!
Thanks.

which one ?
UniqueKey(params string[] ukNames)

On Tue, Apr 19, 2011 at 9:09 AM, Fabio Maulo <[email protected]> wrote:

>         <property name='A' unique-key='AC'/>
>         <property name='B' unique-key='BC'/>
>         <property name='C' unique-key='AC, BC'/>
>
>
> On Tue, Apr 19, 2011 at 9:08 AM, Fabio Maulo <[email protected]> wrote:
>
>> uniquekey is a csv.
>>
>>
>> On Tue, Apr 19, 2011 at 8:43 AM, Luka <[email protected]> wrote:
>>
>>> Hi,
>>> I have this scenario:
>>>
>>> public class User: Entity
>>> {
>>>    public virtual string Username {get;set;}
>>>    public virtual string Password{get;set;}
>>>    public virtual Tenant Tenant {get;set;}
>>> ...
>>> }
>>>
>>> public class Tenant: Entity
>>> {
>>> ...
>>> }
>>>
>>> and mapping like this:
>>>  mapper.Class<User>(map=>
>>>                               {
>>>                                   map.Property(x => x.Username, m =>
>>>                                                                 {
>>>
>>> m.Column(
>>>
>>> cm =>
>>>
>>> {
>>>
>>> cm.UniqueKey("usernamePassword_unique");
>>>
>>> cm.UniqueKey("username_tennant_unique");
>>>
>>> });
>>>
>>> m.Index("username_indx");
>>>
>>> m.Length(20);
>>>                                                                 });
>>>                                   map.Property(x => x.PasswordHash, m
>>> =>
>>>                                                                     {
>>>
>>> m.Column(
>>>
>>> cm =>
>>>
>>> cm.UniqueKey("usernamePassword_unique"));
>>>
>>> m.Length(50);
>>>                                                                     });
>>>                                   map.ManyToOne(x => x.Tenant, m =>
>>> m.Column(cm => cm.UniqueKey("username_tennant_unique")));
>>>                               });
>>>
>>> What I want is to define two composite unique constraints (indexes):
>>> 1. Between Username and password
>>> 2. Between Username and TennatId
>>>
>>> The problem is that the last UniqueKey() for username overrides the
>>> first one, allowing me to have only one.
>>>
>>> How to map this scenarion?
>>>
>>> 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].
>>> For more options, visit this group at
>>> http://groups.google.com/group/nhusers?hl=en.
>>>
>>>
>>
>>
>> --
>> Fabio Maulo
>>
>>
>
>
> --
> Fabio Maulo
>
>


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