using System;
using WPF_CRUD_EFCodeFirst_Simple.Models;
namespace WPF_CRUD_EFCodeFirst_Simple.Migrations
{
using System.Data.Entity.Migrations;
internal sealed class Configuration : DbMigrationsConfiguration<WPF_CRUD_EFCodeFirst_Simple.Models.ManagerDbContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
ContextKey = "WPF_CRUD_EFCodeFirst_Simple.Models.ManagerDbContext";
}
protected override void Seed(WPF_CRUD_EFCodeFirst_Simple.Models.ManagerDbContext context)
{
context.Departmentses.AddOrUpdate(
d=>d.Name,
new Departments { Id = 1 ,Name="Phòng Nhân Sự"},
new Departments { Id = 2, Name="Phòng Kế Toán"},
new Departments { Id = 3, Name="Phòng Hành Chính"}
);
context.Employees.AddOrUpdate(
e=>e.FirstName,
new Employee { FirstName = "A", LastName = "Lê Văn", Birthday = new DateTime(1990,06,26), DepId = 1},
new Employee { FirstName = "B", LastName = "Bùi Văn", Birthday = new DateTime(1988,01,01), DepId = 1},
new Employee { FirstName = "C", LastName = "Nguyễn Thị", Birthday = new DateTime(1985,09,10), DepId = 2},
new Employee { FirstName = "D", LastName = "Nguyễn Anh", Birthday = new DateTime(1989,10,25), DepId = 3},
new Employee { FirstName = "E", LastName = "Phạm Ngọc", Birthday = new DateTime(1980,07,11), DepId = 3}
);
}
}
}