0
sneddo created
Hello,
I want my app to auo migrate any db changes on start up. This is normally pretty simple in that you just call Migrate() on the DB context.
Something like:
using (var serviceScope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope()) { var context = serviceScope.ServiceProvider.GetService<T>(); context.Database.Migrate(); }
Where T is DbContext. In this case MyAppDbContext. But the service provider is unable to resolve the db context so I assume there is another way to do that?
3 Answer(s)
-
0
Is multitenancy enabled on your app?
-
0
Yes it is.
-
0
To migrate db you can check
*.Migrator
project. You should use its same methods because your tenants can have separate database.