KPixel wrote:
There is something wrong with your mapping...
Can you post the whole class AppUser?
The class is pretty big, but the thing is the mappings all work fine. When it looks like this:
Code:
[Id( 0, Name = "ID", TypeType = typeof ( int ), Column = "AppUserID", UnsavedValue = "0" )]
[Generator( 1, Class = "identity" )]
public virtual int ID
{
get { return id; }
set {id = value; }
}
[Bag( 0, Name = "AppRoles", Table = "AppUserRole", Inverse = false, Lazy = true, Cascade = CascadeStyle.None )]
[Cache( 1, Usage = CacheUsage.ReadWrite )]
[Key( 2, Column = "AppUserID" )]
[ManyToMany( 3, ClassType = typeof ( AppRole ), Column = "AppRoleID" )]
public virtual IList<AppRole> AppRoles
{
get { return appRoles; }
set { appRoles = value; }
}
it works fine. But for some reason when you remove the ID property, the second part of the attribute never makes it into the mapping:
Code:
[Id( 0, Name = "ID", TypeType = typeof ( int ), Column = "AppUserID", UnsavedValue = "0" )]
[Generator( 1, Class = "identity" )]
[Bag( 0, Name = "AppRoles", Table = "AppUserRole", Inverse = false, Lazy = true, Cascade = CascadeStyle.None )]
[Cache( 1, Usage = CacheUsage.ReadWrite )]
[Key( 2, Column = "AppUserID" )]
[ManyToMany( 3, ClassType = typeof ( AppRole ), Column = "AppRoleID" )]
public virtual IList<AppRole> AppRoles
{
get { return appRoles; }
set { appRoles = value; }
}