我有有許多角色nPoco V3 - 多對多不工作
public class User
{
public int Id {get;set;}
public string Name {get;set;}
public List<Role> Roles {get;set;}
}
public class Roles
{
public int Id {get;set;}
public string Key{get;set;}
}
public class UserRoles
{
public int UserId {get;set;}
public int RoleId {get;set;}
}
什麼,我儘量做到越來越及其所有角色的用戶在一個查詢,但到目前爲止,我失敗了用戶。 映射我使用一個自定義Conventionbased映射器(我可以提供的代碼,但它是相當大的)
我試圖FetchOneToMany,我試圖抓取這裏所描述
https://github.com/schotime/NPoco/wiki/One-to-Many-Query-Helpers https://github.com/schotime/NPoco/wiki/Version-3
但角色總是空。 角色和用戶本身的正確映射,我也嘗試指定像
For<User>().Columns(x =>
{
x.Many(c => c.Roles);
x.Column(c => c.Roles).ComplexMapping();
}, true);
的關係同樣也沒有幫助,角色是空的。
我不知道我在想什麼。 任何想法?