public static Customer GetCustomerDetailsByKey(int customerId) { using (var cusrepo = new CustomerRepository()) { return(cusrepo.AllIncluding(c => c.Addresses, c => c.Orders) .Where(c => c.Id == customerId).First()); } }
private static void GetCustomersWhoHaveOrdersAndIncludeOrders() { using (var repo = new CustomerRepository()) { foreach (var customer in repo.AllIncluding(c => c.Orders).Where(c => c.Orders.Any())) { System.Console.WriteLine("{0} {1} Order Count={2}", customer.FirstName, customer.LastName, customer.Orders.Count); } } }
public void Customers_Should_Have_SalesOrders_Included() { var customers = _repo.AllIncluding(c => c.SalesOrders); Assert.IsTrue(customers.Any(c => c.SalesOrders.Any())); }