public class News
{
public int ID { get; set; }
public string Title { get; set; }
public List<Role> RoleList { get; set; }
}
public class Role
{
public int ID { get; set; }
public string Title { get; set; }
public List<User> UserList { get; set; }
public List<News> NewsList { get; set; }
}
public class User
{
public int ID { get; set; }
public string Name { get; set; }
public List<Role> RoleList { get; set; }
}
请问怎么查询用户所拥有角色的新闻内容列表,谢谢!
var news = db.Users.SelectMany(u => u.RoleList.SelectMany(r => r.NewsList));