Repro:
await using var ctx = new BlogContext();
await ctx.Database.EnsureDeletedAsync();
await ctx.Database.EnsureCreatedAsync();
public class BlogContext : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder.UseSqlServer(...);
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Blog>()
.HasNoKey()
.HasData(new Blog { Name = "foo" });
}
}
public class Blog
{
public string Name { get; set; }
}
Happens on both the latest 5.0 and 3.1.