Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

420
Views
Cómo aplicar migraciones desde código (EF Core)

Aquí hay un código de migración EF6 que funciona:

 Database.SetInitializer<CmContext>(null); var settings = new MigrationsConfiguration(); var migrator = new DbMigrator(settings); migrator.Update();

¿Cuál es el equivalente usando EF Core?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

En beta 7 y en adelante, use:

 using Microsoft.Data.Entity; ... context.Database.Migrate();
over 4 years ago · Santiago Trujillo Report

0

Para Entity Framework Core 1.0.0, asegúrese de tener el paquete Microsoft.EntityFrameworkCore.Relational NuGet. Luego importe este espacio de nombres:

 using Microsoft.EntityFrameworkCore;

Finalmente, hazte con un DbContext y ejecuta:

 context.Database.Migrate();
over 4 years ago · Santiago Trujillo Report

0

De acuerdo con la documentación de Microsoft, para escenarios más avanzados que simplemente aplicar las migraciones que ya están presentes en la estructura de archivos de su proyecto, puede usar el servicio EF Core IMigrator . Puede acceder fácilmente a la implementación interna utilizando el siguiente código de acceso:

 var migrator = myDbContext.GetInfrastructure().GetService<IMigrator>();
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!