LINQ JOIN Query Returning String Array

Query:

  1. string[] roles =( from usr in dataBaseEntities.Users  
  2. join uir in dataBaseEntities.UserInRoles  
  3. on usr.UserId equals uir.UserId  
  4. join rl in dataBaseEntities.Roles  
  5. on uir.RoleId equals rl.RoleId  
  6. where usr.UserId==user.UserId  
  7. select new { rl.RoleName }). AsEnumerable().Select(x => string.Format("{0}", x.RoleName)).ToArray(); 

Output: It will give all the roles assigned to the Particular user based on usedId.

Output

Ebook Download
View all
Learn
View all