/// <summary> /// Gets all employees. /// </summary> /// <returns>a list of Employees</returns> public IEnumerable<Employee> GetAllEmployees() { using (var context = new NorthwindEntities(GetEntityConnection())) { return (from item in context.Employees select item).ToList(); } }
public IEnumerable<Customer> GetAllCustomers() { Thread.Sleep(500); using (var context = new NorthwindEntities(GetEntityConnection())) { return (from item in context.Customers select item).ToList(); } }
/// <summary> /// Gets the orders from customer. /// </summary> /// <param name="customerId">The customer id.</param> /// <returns></returns> public IEnumerable<Order> GetOrdersFromCustomer(string customerId) { var orders = new List<Order>(); using (var context = new NorthwindEntities(GetEntityConnection())) { context.ContextOptions.LazyLoadingEnabled = false; orders = (from item in context.Orders where item.CustomerID.Equals(customerId) select item).ToList(); } return orders; }