title: Access database (EF Core DbContext) in ConfigureServices of ASP.Net Core
body: <p>I want to add some policies to ASP.Net Core authorization, which are stored in my database (EF Core with MySQL). The goal is to limit users' access based on their authorities. As far as I know, I should do it in the <code>ConfigureServices</code> method in the <code>Startup</code> class like this:</p>
  <pre><code>services.AddAuthorizationCore(options =&gt;
  {
    options.AddPolicy(&quot;CanEditUserGroups&quot;, builder =&gt;
    {
      builder.RequireAuthenticatedUser();
      builder.RequireClaim(&quot;Permission&quot;, &quot;Value&quot;);
    });
  });
  </code></pre>
  <p>But, the problem is that I want to have several policies and read their <code>&quot;Value&quot;</code> from the database. Is it possible to instantiate my DbContext service and read data from that? Am I doing it the right way?</p>