2

In my application I have 3 entities:

class User
{
    public List<Role> Roles { get; protected set; }
}

class Role
{
    public List<User> Users { get; protected set; }
}

internal class UserInRole
{
    public User User { get; protected set; }
    public Role Role { get; protected set; }
    public string Flag { get; protected set; }
}

(Yes, I know it is possible to create many-to-many relation without UserInRole entity, but I need it)

And in result I want to have 3 tables. Table UserInRole must have composite key to UserId and RoleId. Now my mapping for UserInRole looks like here:

CompositeId()
    .KeyReference(x => x.User)
    .KeyReference(x => x.Role);

But it doesn't works.

Any help?

griZZZly8
  • 694
  • 9
  • 24
  • what do you mean it doesn't work ? Are you getting some kind of error/exception you can share ? – gillyb Feb 09 '13 at 20:17

0 Answers0