示例#1
0
 public static void UpdateDatabase()
 {
     using (EFCoreDemoDbContext dbContext = new EFCoreDemoDbContext()) {
         CreateITDepartmentModel(dbContext);
         CreateSalesDepartmentModel(dbContext);
         CreateProductionDepartmentModel(dbContext);
         dbContext.SaveChanges();
     }
     SecuritySetUp();
 }
示例#2
0
 private static void CreateContacts()
 {
     using (EFCoreDemoDbContext context = new EFCoreDemoDbContext()) {
         Contact developer = new Contact()
         {
             Name    = "John",
             Address = "Boston"
         };
         Contact writer = new Contact()
         {
             Name    = "Kevin",
             Address = "California",
         };
         Contact designer = new Contact()
         {
             Name    = "Ezra",
             Address = "San Francisko",
         };
         context.Contacts.Add(designer);
         context.Contacts.Add(writer);
         context.Contacts.Add(developer);
         context.SaveChanges();
     }
 }