title: How to configure IdentityOptions outside ConfigureServices?
body: <p>I want to configure <code>ASP.NET Core Identity</code> based on settings which resides in database rather than <code>AppSetting.json</code> or hard coded values. Consequently, I'am eager to call following line of code outside of method <code>ConfigureServices(IServiceCollection services)</code>:</p>
  
  <pre><code>services.Configure&lt;IdentityOptions&gt;(x =&gt; x.Password.RequireDigit = true);
  </code></pre>
  
  <p>This way of calling will allow me to initialize <code>DbContext</code> before trying to configure <code>Identity</code>. </p>
  
  <p>Currently I'm using <code>services.BuildServiceProvider()</code> in the <code>ConfigureServices()</code> to access database values. This style has a huge disadvantage for me: It puts an extra initialization on the application's <code>DbContext</code> which is dirty and slow. In the other hand, <code>DbContext</code> is instantiated two times instead of one.</p>
  
  <p>If I was able to call <code>services.Configure&lt;IdentityOptions&gt;()</code> outside the <code>ConfigureServices()</code>, for example in the <code>configure()</code> method, I would be able to configure <code>Identity</code> options based on database values without initializing <code>DbContext</code> twice.</p>
  
  <p>Again, my question is how to configure <code>IdentityOptions</code> outside <code>ConfigureServices</code>?</p>
  
  <p>Any help is appreciated.</p>