private static void FindEmployee(InMemoryUnitOfWork inMemoryUnitOfWork) { var employee = inMemoryUnitOfWork.Employees.Single(e => e.Name == "Lenny"); Console.WriteLine(employee.ToString()); inMemoryUnitOfWork.Commit(); }
private static void UpdateEmployee(InMemoryUnitOfWork inMemoryUnitOfWork) { var employee = inMemoryUnitOfWork.Employees.Single(e => e.Name == "Mr Burns"); employee.Name = "Waylon Smithers"; Console.WriteLine("Updated {0}", employee); inMemoryUnitOfWork.Commit(); }
private static void RemoveEmployee(InMemoryUnitOfWork inMemoryUnitOfWork) { var employee = inMemoryUnitOfWork.Employees.Single(e => e.Name == "Lenny"); inMemoryUnitOfWork.Employees.DeleteObject(employee); Console.WriteLine("Removed {0}", employee); inMemoryUnitOfWork.Commit(); }
private static void AddEmployee(InMemoryUnitOfWork inMemoryUnitOfWork) { var employee = new Employee { Name = "Bart Simpson" }; inMemoryUnitOfWork.Employees.AddObject(employee); Console.WriteLine("Added {0}", employee); inMemoryUnitOfWork.Commit(); }