开发者

Many to Many LINQ TO SQL Query

I have the following tables:

Users

Roles

UserRoles

开发者_JAVA百科 MenuItems

RoleMenuItems

A 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);

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜