.net core 3.0 Auto migration does not create/update/ datatable automatically

asp.net-core entity-framework-core

Question

I am building a project template using .net core 3.0 and Microsoft.EntityFrameworkCore. this will just created the database schema not the data table

if (!context.Database.EnsureCreated())
    context.Database.Migrate();

Do we have an automatic migration that helps to create/update datatable without needing to manually call Add-Migration Update database

I was able to build it automatically in .net using Code base EF6, it will just detect if you have created a new field in the model and add it to database automatically.

Do we have something in .net Core ? Thanks

1
0
4/1/2020 4:01:36 AM

Popular Answer

Do we have an automatic migration that helps to create/update datatable without needing to manually call Add-Migration Update database

As far as I know, automatic migration feature has been removed in EF Core.

And DbContext.Database.Migrate(); just help apply any pending migrations for the context to the database, which mean that we should created migration(s) first otherwise it would not work.

0
4/3/2020 8:01:33 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow