I appreciate that sample of having a separate worker to apply database migrations.
My question is, why does this code seem to duplicate the logic of the in-built context.Database.Migrate()? What does this gain us vs simpler code? Is the canonical example not transactional? Does breaking out the code provide better logging?
I appreciate that sample of having a separate worker to apply database migrations.
My question is, why does this code seem to duplicate the logic of the in-built
context.Database.Migrate()
? What does this gain us vs simpler code? Is the canonical example not transactional? Does breaking out the code provide better logging?vs.
https://github.com/dotnet/aspire-samples/blob/main/samples/DatabaseMigrations/DatabaseMigrations.MigrationService/ApiDbInitializer.cs
Canonical example: