how can i retrieve multiple column values with same foreign key id using linq method syntax in c?

Better to stay with LINQ query syntax which is closer to the SQL and you can easily modify your query. Anyway here is your translation:

 var query2 = _context.Users
    .Where(u => u.Username == username)
    .Join(_context.UserRoles, u => u.UserID, ur => ur.UserId, (u,ur) => ur.Role)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top