I am using nHibernate 3.2 build in mapping and are getting an error "*An 
association from the table Users_Roles refers to an unmapped class*"
I have a User class and a Role class where each can contain many of the 
other. (ie: Users has a IList<Role> Roles member and Role have a 
IList<User> member)

My database tables are set up (Users, Roles, and a link table "Users_Roles" 
with UserId and RoleId columns.

My UserMap table look as follows (and the same format for the RoleMap class)
    public class UserMap : ClassMapping<User>
    {
        public UserMap()
        {
            Id(x => x.Id, m => m.Generator(Generators.Identity));
            ......
            Bag(x => x.Roles, collectionMapping =>
                                  {
                                      
collectionMapping.Table("Users_Roles");
                                      
collectionMapping.Cascade(Cascade.None);
                                      collectionMapping.Key(k => 
k.Column("UserId"));
                                  },
                map => map.ManyToMany(p => p.Column("RoleId")));

            Table("Users");
        }
    }

Not sure what additional information would be required to help me sort this 
one out?

-- 
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/-/xGNxLS6ekf0J.
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