My implementation code for seeding in Entity Framework 6 dosent seem compatible with EntityFramework core
Here is my code
public class CustomerOrderSeedData : DropCreateDatabaseIfModelChanges<CustomerOrderEntities>
{
protected override void Seed(CustomerOrderEntities context)
{
GetOrderDetails().ForEach(od => context.OrdersDetails.Add(od));
context.Commit();
}
private static List<OrdersDetails> GetOrderDetails()
{
return new List<OrdersDetails>
{
new OrdersDetails {
OrderId = 1,
ProductId = 1,
Quantity = 10,
UnitPrice = 12,
Discount = 3
},
new OrdersDetails {
OrderId = 1,
ProductId = 2,
Quantity = 3,
UnitPrice = 4,
Discount = 2
}
}
}
EntityFrameworkCore doesn't seem to like DropCreateDatabaseIfModelChanges keyword.Could somebody show me an example of how seeding is done using EntityFrameworkcore.