SQLite - No Such Table Error

Are you using SQLite as an in-memory provider for EF Core on your Unit/Integration test? If you are, you may come across the following exception when creating the in-memory database. As you can see from the exception, the error is “SQLite Error 1: ’no such table vPet’” which is odd because vPet is defined as a SQL view on my DbContext, not a SQL table. Here is my PetsDbContext. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 public class PetsDbContext : DbContext { // Rest of code omitted for brevity public DbSet<Pet> Pets { get; set; } public PetsDbContext() { } public PetsDbContext(DbContextOptions<PetsDbContext> options) : base(options) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { // Rest of code omitted for brevity modelBuilder....

September 19, 2020 · Yunier