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. 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