Exemple #1
0
 public void InsertExampleData()
 {
     using (var context = new EmployeeBookEntities())
     {
         ExampleDataGenerator.InsertExampleData(context);
         context.SaveChanges();
     }
 }
Exemple #2
0
 static void Main(string[] args)
 {
     using (var dbContext = new EmployeeBookEntities())
     {
         dbContext.Employees.Add(new Employee
         {
             FirstName  = "Иван",
             SecondName = "Иванов",
             ThirdName  = "Иванович"
         });
         dbContext.SaveChanges();
         var id    = dbContext.Employees.First().ID;
         var count = dbContext.Employees.Count();
     }
 }