I have the following tables:
Users
Roles UserRoles开发者_JAVA百科 MenuItems RoleMenuItemsA User can have multiple Roles and a MenuItem can be accessed by multiple Roles. Now I want to write a method as follows:
public IList<MenuItems> GetMenuItems(UserRoles userRoles)
{
var menus = // LINQ query to get the MenuItems by UserRoles
return menus.ToList();
}
Is there a way to do this?
userRoles.SelectMany(i => i.MenuItems);
精彩评论