【发布时间】:2014-10-29 14:36:39
【问题描述】:
我有一个用户属于具有特定角色的社区,User、Community、CommunityRole 和 CommunityRoleType 的类描述如下:
public class User{
public int UserId { get; set;}
public List<CommunityRole> CommunityRoles { get; set; }
}
public class Community{
public int CommunityId { get; set;}
public string Name { get; set; }
}
public enum CommunityRoleType{
Type1,
Type2
}
public class CommunityRole {
public Community Community { get; set; }
public CommunityRoleType RoleType {get; set; }
}
如何从用户列表中获取属于特定社区并被分配特定角色的用户子集??
【问题讨论】:
-
到目前为止,您为实现这一目标做了哪些尝试,您尝试的解决方案遇到了哪些具体问题?
-
我们可以看看你的
UserCommunityRole课程吗? -
"假设有一个类 Community"...你为什么不把代码也放到 Community 类中呢?
-
@BenRobinson 我认为 UserCommunityRole 和 CommunityRole 是一样的,他只是有一个错字
-
这是一个错字。我会改正的,
标签: c# linq entity-framework-6