I am pulling my hair out here trying to figure out how to map the UsersRoles table listed below. I don't look good bald so please help :)
//Here is the Entity
public class UsersRole
{
public UsersRole() { }
public virtual User User { get; set; }
public virtual Role Role { get; set; }
public virtual System.Guid UserId { get; set; }
public virtual System.Guid RoleId { get; set; }
}
//Here is the mapping so far
public class UsersRoleMap : ClassMapping<UsersRole>
{
public UsersRoleMap()
{
Table("UsersRoles");
Lazy(true);
// ComponentAsId(); How does this work??
Property(x => x.UserId, map => map.Column(c =>
{
c.Name("UserId");
c.NotNullable(true);
c.Length(30);
c.SqlType("uniqueidentifier");
}));
Property(x => x.RoleId, map => map.Column(c =>
{
c.Name("RoleId");
c.NotNullable(true);
c.Length(30);
c.SqlType("uniqueidentifier");
}));
}
}
Please see the comment in the mapping for ComponentAsId
Thanks in advance if someone can get me on the right track