title: Creating Roles in Asp.net Identity MVC 5
body: <p>There is very little documentation about using the new Asp.net Identity Security Framework.</p>
  
  <p>I have pieced together what I could to try and create a new Role and add a User to it.  I tried the following: <a href="https://stackoverflow.com/questions/19541101/add-role-in-asp-net-identity">Add role in ASP.NET Identity</a></p>
  
  <p>which looks like it may have gotten the info from this blog: <a href="http://blogs.msdn.com/b/webdev/archive/2013/10/20/building-a-simple-todo-application-with-asp-net-identity-and-associating-users-with-todoes.aspx" rel="noreferrer">building a simple to-do application with asp.net identity and associating users with to-does</a></p>
  
  <p>I have added the code to a Database Initializer that is run whenever the model changes. It fails on the <code>RoleExists</code> function with the following error: </p>
  
  <blockquote>
    <p><code>System.InvalidOperationException</code> occurred in mscorlib.dll 
    The entity type IdentityRole is not part of the model for the current context.</p>
  </blockquote>
  
  <pre><code>protected override void Seed (MyContext context)
  {
      var UserManager = new UserManager&lt;ApplicationUser&gt;(new UserStore&lt;ApplicationUser&gt;(context)); 
      var RoleManager = new RoleManager&lt;IdentityRole&gt;(new RoleStore&lt;IdentityRole&gt;(context));
  
      // Create Admin Role
      string roleName = "Admins";
      IdentityResult roleResult;
  
      // Check to see if Role Exists, if not create it
      if (!RoleManager.RoleExists(roleName))
      {
          roleResult = RoleManager.Create(new IdentityRole(roleName));
      }
  }
  </code></pre>
  
  <p>Any help is appreciated.</p>