title: How do I create a relationship between AspNetUserRoles and some other table using EF6 code first?
body: <p>I'm using ASP.Net Identity 2 and EF6 code first migrations for this project and I'm struggling to create a table to link 3 other tables. I have the following:</p>
  
  <ul>
  <li>Company</li>
  <li>ApplicationUser (AspNetUsers)</li>
  <li>ApplicationRole (AspNetRoles)</li>
  <li>AspNetUserRoles</li>
  </ul>
  
  <p>The tricky bit is to relate the AspNetUserRoles with the Company table, because a user can have roles in different companies and can also have a role that's not related to any company. So ideally the resulting table I need would be something like:</p>
  
  <ul>
  <li>CompanyUserRoles(companyId, UserRoleId[this is not roleID]) or even (companyId, roleid,userid)</li>
  </ul>
  
  <p>Another option would be to add another field (companyId) to the AspNetUserRoles table.</p>
  
  <p>It's kind of confusing how can I achieve this with code first and what implications would it have when it comes to the UserManager and RoleManager (do I need to create custom ones?).</p>
  
  <p>Any guidance would be greatly appreciated.</p>