Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

How to Seed Data in Core?

$
0
0

Hi,

Below code is EF6 seed migration, but what is the equivalent in Core to seed data?

using System.Data.Entity.Migrations;
using System.Linq;

internal sealed class Configuration : DbMigrationsConfiguration<ApplicationDBContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = true;
}

protected override void Seed(ApplicationDBContext context)
{
context.Customers.AddOrUpdate(new Customers(){Id = 321, Name = "John Done"});
}
}



Thanks,


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>