public void Sach(TestMVCDbContext context) { if (!context.NhanViens.Any()) { A.Configure <Sach>() .Fill(s => s.Name); var sach = A.ListOf <Sach>(50); context.Saches.AddRange(sach); context.SaveChanges(); //context.Suppliers.Add(new Supplier() //{ // Name = "SamSung Viet Nam", // CodeName = "SSVN", // Email = "*****@*****.**", // Phone = "0971489926" //}); //context.SaveChanges(); //context.Suppliers.Add(new Supplier() //{ // Name = "LG Viet Nam", // CodeName = "LGVN", // Email = "*****@*****.**", // Phone = "0971489926" //}); //context.SaveChanges(); } }
private void DbContextSeed(TestMVCDbContext context, int retry = 0) { int retryForAvaiability = retry; try { Sach(context); //ChuDe(context); //Sach(context); //NhaXuatBan(context); } catch (Exception ex) { if (retryForAvaiability < 10) { retryForAvaiability++; DbContextSeed(context, retryForAvaiability); } } }
public ChuDeRepository(TestMVCDbContext context) { _context = context; }
public NhanVienRepository(TestMVCDbContext context) { _context = context; }
public HopDongRepository(TestMVCDbContext context) { _context = context; }
public DocGiaRepository(TestMVCDbContext context) { _context = context; }
public SachRepository(TestMVCDbContext context) { _context = context; }
public NhaXuatBanRepository(TestMVCDbContext context) { _context = context; }