title: ASP.NET 6 + Identity + Sqlite, services.AddDbContext() how?
body: <p>I am using a tutorial for ASP.NET Core 5.0 + SQL Server, but I am actually using ASP.NET Core 6.0 + Sqlite.</p>
  <p>The tutorial has the following code in <code>StartUp.cs</code></p>
  <pre><code>public void ConfigureServices(IServiceCollection services)  
  {  
      services.AddControllers();  
      services.AddDbContext&lt;ApplicationDbContext&gt;(options =&gt; options.UseSqlServer(Configuration.GetConnectionString(&quot;ConnStr&quot;)));  
  }  
  </code></pre>
  <p>but in my project, that file or class does not exist. There is a <code>Program.cs</code> file that has no classes or methods but just lines of code. I guessed that it is what is replacing that class, so I tried to  use it</p>
  <pre><code>builder.Services.AddDbContext&lt;ApplicationDbContext&gt;(options=&gt; options.);
  </code></pre>
  <p><code>options</code> had no such method like <code>UseSqlServer</code>. I thought that it is because I am using Sqlite, not SQL Server, so I searched the web for an example for Sqlite but the methods that those example did not exist either. I can see <code>AddEntityFrameworkSqlite</code>, but that was about it.</p>
  <p>How can I make this work?</p>
  <p>I have added the following relevant packages:</p>
  <ul>
  <li>Microsoft.AspNetCore.Identity</li>
  <li>Microsoft.AspNetCore.Identity.EntityFrameworkCore</li>
  <li>Microsoft.EntityFrameworkCore.Sqlite.Core</li>
  <li>Microsoft.EntityFrameworkCore.Tools</li>
  </ul>
  <p>Other classes are the same as <a href="https://www.c-sharpcorner.com/article/authentication-and-authorization-in-asp-net-5-with-jwt-and-swagger/" rel="noreferrer">the original tutorial</a>.</p>
  <p>Here is the <code>DbContext</code> class.</p>
  <pre><code>using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
  using Microsoft.EntityFrameworkCore;
  
  public class ApplicationDbContext:IdentityDbContext&lt;ApplicationUser&gt;
  {
      public ApplicationDbContext(DbContextOptions&lt;ApplicationDbContext&gt; options):base(options)
      {
      }
  }
  </code></pre>
  <p>The <code>Program.cs</code> code I was trying to edit:</p>
  <pre><code>using WebApplication1.Authentication;
  
  var builder = WebApplication.CreateBuilder(args);
  
  // Add services to the container.
  
  builder.Services.AddControllers();
  
  builder.Services.AddDbContext&lt;ApplicationDbContext&gt;(options=&gt; options.);
  
  var app = builder.Build();
  
  // Configure the HTTP request pipeline.
  
  app.UseAuthorization();
  
  app.MapControllers();
  
  app.Run();
  </code></pre>