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

424
Views
How to apply migrations from code (EF Core)

Here is some working EF6 migration code:

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

What is the equivalent using EF Core?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

In beta 7 and on, use:

using Microsoft.Data.Entity;

...

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

0

For Entity Framework Core 1.0.0, ensure you have the Microsoft.EntityFrameworkCore.Relational NuGet package. Then import this namespace:

using Microsoft.EntityFrameworkCore;

Finally, get hold of a DbContext and run:

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

0

According to the Microsoft documentation, for more advanced scenarios than simply applying the migrations which are already present in your project file structure, you can use the EF Core IMigrator service. You can easily access the internal implementation by utilizing the following access code:

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!