✅ Can you run EF Core migration update at application startup rather than with the CLI tools?

^
5 Replies
Angius
Angius5mo ago
Yes
Jimmacle
Jimmacle5mo ago
dbContext.Database.MigrateAsync()
nathanAjacobs
nathanAjacobsOP5mo ago
Thanks!!! So I would just call that when configuring services or what?
Jimmacle
Jimmacle5mo ago
you'd call it after building the host because you need the DI container to be built to pull the dbcontext out
nathanAjacobs
nathanAjacobsOP5mo ago
Gotcha, awesome!

Did you find this page helpful?