title: How to convert from IdentityUserRole to IdentityRole (ASP.NET Core)
body: <p>I'm working on a controller in my project. I'm trying to do the following:</p>
  
  <pre><code>string role = "something";
  var newRole = new IdentityRole();
  
  newRole = _DbContext.Roles.Where(r =&gt; r.Name == role).FirstOrDefault().;
  user.Roles.Add(newRole);
  </code></pre>
  
  <p>Apparently, user.Roles.Add() only takes a IdentityUserRole as a parameter, but newRole is of type IdentityRole. How can I convert from one to the other? Is there an alternate way to accomplish what I want to do?</p>
  
  <p>Explicitly casting doesn't work.</p>