예제 #1
0
 private static void SeedData(CarShopDbContext context)
 {
     if (!context.Cars.Any(car => car.Id == 1))
     {
         context.Cars.Add(new Car
         {
             Manufacturer = "Volvo",
             Model        = "V70",
             Price        = 10000,
             Year         = 1996,
             Seats        = 2
         });
         context.SaveChanges();
     }
 }
예제 #2
0
 public static void Initialize(CarShopDbContext context)
 {
     context.Database.Migrate();
     SeedData(context);
 }