Exemplo n.º 1
0
 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());
     }
 }
Exemplo n.º 2
0
 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);
         }
     }
 }
Exemplo n.º 3
0
        public void Customers_Should_Have_SalesOrders_Included()
        {
            var customers = _repo.AllIncluding(c => c.SalesOrders);

            Assert.IsTrue(customers.Any(c => c.SalesOrders.Any()));
        }