I have a strange problem that my migration is not recognised by the EF Core 2.0
When running the Add-Migration
command in PM, the MyFirstMigration
classes are created inside the Migrations
folder.
Context:
Protected Overrides Sub OnConfiguring(optionsBuilder As DbContextOptionsBuilder )
optionsBuilder.UseSqlite("Data Source=blogging.db")
End Sub
PM code:
PM> Add-Migration MyFirstMigration
To undo this action, use Remove-Migration.
PM> Update-Database
No migrations were applied. The database is already up to date.
Done.
When I check the dababase file, __EFMigrationsHistory table exists, but not the Blog table. As you may suspect, running db.SaveChanges() throws an exception and tells me that table doesn't exists.
Running db.Database.Migrate() does nothing, but when I delete the db file and run db.Database.EnsureCreated(), correct database is created.
I must point out that __EFMigrationsHistory table is created empty, so I can immediately after Update-Database create the next migration and it will generate exactly the same code as in the first one.
I am using VS 15.3.5 and .Net 4.6.1 on WPF.
/ Best regards