title: Create role using entity framework core migrations
body: <p>I'm creating my 4th migrations script with EF Core (2.0.0). In there I want to add a few roles to the database.</p>
  
  <p>The problem is, is that I'm not really sure how to do this. Currently I have this:</p>
  
  <pre><code>protected override void Up(MigrationBuilder migrationBuilder)
  {
      // todo: Pass connection string somehow..?
      var opt = new DbContextOptions&lt;ApplicationContext&gt;();
      var roleManager = new RoleManager&lt;IdentityRole&gt;(new RoleStore&lt;IdentityRole&gt;(new ApplicationContext(opt)));
  
      //if (!roleManager.RoleExists("ROLE NAME"))
      //{
          // todo: create the role...
      //}
  }
  </code></pre>
  
  <p>But creating the <code>RoleManager</code> like that gives me the following error:</p>
  
  <blockquote>
    <p>There is no argument given that corresponds to the required formal
    parameter 'roleValidators' of
    'RoleManager.RoleManager(IRoleStore,
    IEnumerable>, ILookupNormalizer,
    IdentityErrorDescriber, ILogger>)'</p>
  </blockquote>
  
  <p>I'm not sure how to solve this problem. I couldn't find any info on how to do this properly in .NET Core using migrations.</p>
  
  <p>I'm facing two issues in this code:</p>
  
  <ul>
  <li>I'm trying to create an instance of the DbContext somehow. Shouldn't I be able to get the DbContext from within my migrations code?</li>
  <li>Instantiating the <code>RoleManager</code> like this doesn't work and needs to be resolved.</li>
  </ul>
  
  <p>How can I solve these problems?</p>