title: ASP.Net Core how to get the user role in EF Core and Identity
body: <p>Hi I'm building a API using Identity with a custom user class,and EF Core.
  I want to get the name of the role that belongs to an user.
  The diagram of the tables is the following(ignore userclaims and userlogins): 
  <a href="https://i.stack.imgur.com/COdFl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/COdFl.png" alt="enter image description here"></a></p>
  
  <p>As you can see the Roles and Users is N to N so internally Identity made a junction table named UserRoles, my contoller looks like this:</p>
  
  <pre><code>Route ("api/[controller]")]
      public class UserController : Controller {
          private readonly DBContext _db;
          private readonly UserManager&lt;Usuario&gt; _userManager;
          public UserController (DBContext db, UserManager&lt;Usuario&gt; userManager) {
              this._db = db;
          }
          [HttpGet ("GetUserById/{id}", Name = "GetUserById")]
          public async Task&lt;IActionResult&gt; GetUserById (string id) {
              try {
  
                  var user = await this._db.Users.Where (x =&gt; x.Id == id).Include (x =&gt; x.Roles).FirstOrDefaultAsync ();
                  if (user == null) {
                      return NotFound ();
                  }
                  return Ok (user);
              } catch (Exception e) {
                  Console.WriteLine (e.Message);
                  return BadRequest ();
              }
          }
  </code></pre>
  
  <p>When I called it in Postman I get the following response: </p>
  
  <p><a href="https://i.stack.imgur.com/7CEKT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7CEKT.png" alt="enter image description here"></a></p>
  
  <p>As you can see in the roles part all I get is: </p>
  
  <pre><code>"roles": [
          {
              "userId": "d88b0c2d-25c5-4da9-ad05-45f69dec67ff",
              "roleId": "a83a60ca-f011-43ce-be3d-8b71403aa86e"
          }
      ]
  </code></pre>
  
  <p>That data belongs to the junction table not the Role table itself, I dont want that.</p>
  
  <p>What I really want is the "real" Role table data, Any idea how can I achieve that? </p>
  
  <p>In sql it would be something like : </p>
  
  <pre><code>select *
      from AspNetUsers as a,AspNetUserRoles as b,AspNetRoles as c 
      where a.Id = b.UserId and b.RoleId= c.Id 
  </code></pre>