1
votes

I have two tables called Users and Roles , and a bridge table to form many to many relation between users and roles. My Question is that how can i create mapping for many to many relation in fluent nHibernate.

table User :

    UserID
    UserName
    Password
    FullName

Table Roles:

    RoleID
    RoleName
    Description

Table Bridge:

    UserID
    RoleID

I have mapping tblUser like this

class tblUsersMap : ClassMap<tblUsers>
{
    public tblUsersMap()
    {
        Id(user => user.UserID).GeneratedBy.Identity();
        Map(user => user.UserName).Not.Nullable();
        Map(user => user.Password).Not.Nullable();
        Map(user => user.FullName).Not.Nullable();
    }
}

and same way for mapping for Role table , but how can i define many to many mapping there?

Thanks

1

1 Answers

1
votes