How do we use data migrations in asp.net core? I'v tried looking through the asp.net core documentation but couldn't find anything.
This was the code for asp.net 4:
internal sealed class Configuration : DbMigrationsConfiguration<ApplicationDbContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = true;
}
protected override void Seed(ApplicationDbContext context)
{
base.Seed(context);
//Add stuff to database
context.SaveChanges();
}
}
What is the equivalent in asp.net core?
If you're using EF core: https://docs.efproject.net/en/latest/miscellaneous/cli/dotnet.html
If you're using EF 6.x, you may need a community one: https://github.com/mrahhal/Migrator.EF6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With