Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

780
Vistas
How to apply EF Core migrations if you should not use MigrateAsync() for production environments?

I created a new .Net 5 project and want to use EF Core. I autogenerated multiple migration.cs files using

dotnet ef migrations add MyMigration

and want to apply them (for development and production). I know about the MigrateAsync method so I read about how to call this method on startup

https://andrewlock.net/running-async-tasks-on-app-startup-in-asp-net-core-part-1/

but everywhere I read that this method should not be used for production since those migrations won't be executed in a single transaction (no rollback on errors).

Unfortunately there are not many resources on how to do it regardless of the environment, I found this article

https://www.thereformedprogrammer.net/handling-entity-framework-core-database-migrations-in-production-part-2

One option could be a console app calling the migrations

https://www.thereformedprogrammer.net/handling-entity-framework-core-database-migrations-in-production-part-2/#1b-calling-context-database-migrate-via-a-console-app-or-admin-command

but I wasn't able to understand the difference for this approach because it's not solving the transactional problem?

What are best practises to apply migrations during development/production?

  • After autogenerating migrations I'm a big fan of simplicity, does dotnet ef database update the job and I don't need to work with additional tools?

  • Create a console app, generate .sql files from the migrations, install DbUp and use it for the migration part?

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda