I am following this guide on how to build a Blazor application. I am running into an issue with the line builder.Services.AddSqlite<PizzaStoreContext>("Data Source=pizza.db");.
The error I am getting is 'IServiceCollection' does not contain a definition for 'AddSqlite' and no accessible extension method 'AddSqlite' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)
The program.cs file looks like this:
using BlazingPizza.Data;var builder = WebApplication.CreateBuilder(args);builder.Services.AddRazorPages();builder.Services.AddServerSideBlazor();builder.Services.AddSingleton<PizzaService>();builder.Services.AddHttpClient();builder.Services.AddSqlite<PizzaStoreContext>("Data Source=pizza.db");var app = builder.Build();if (!app.Environment.IsDevelopment()){ app.UseExceptionHandler("/Error");}app.UseStaticFiles();app.UseRouting();app.MapRazorPages();app.MapBlazorHub();app.MapFallbackToPage("/_Host");app.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");// Initialize the databasevar scopeFactory = app.Services.GetRequiredService<IServiceScopeFactory>();using (var scope = scopeFactory.CreateScope()){ var db = scope.ServiceProvider.GetRequiredService<PizzaStoreContext>(); if (db.Database.EnsureCreated()) { SeedData.Initialize(db); }}app.Run();The PizzaStoreContext.cs looks like this:
using Microsoft.EntityFrameworkCore;namespace BlazingPizza.Data;public class PizzaStoreContext : DbContext{ public PizzaStoreContext(DbContextOptions options) : base(options) { } public DbSet<PizzaSpecial> Specials { get; set; }}This seems to match up with what is in the guide. What have I got wrong?