I solved it this way (I use slightly different conventions here):
https://gist.github.com/1200323
 
With this code
 
mapper.ManyToMany<User,Role>(e=>e.Roles, e=>e.Users);
 
I get the following DDL:
 
create table User_Roles (
 User_key UNIQUEIDENTIFIER not null,
 Roles_key UNIQUEIDENTIFIER not null,
 primary key (User_key, Roles_key)
)
 
Using this method, I can even use multiple M:N relations between two 
entities, since the table name refers only to the class and property 
controlling the relation. For example
 
 mapper.ManyToMany<User,Role>(e=>e.DeniedRoles);
 
creates a second relationtable between User and Role:
 
 create table User_DeniedRoles (
 User_key UNIQUEIDENTIFIER not null,
 DeniedRoles_key UNIQUEIDENTIFIER not null,
 primary key (User_key, DeniedRoles_key)
)
 
-Markus

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/a4IIMid136wJ.
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