Ejemplo n.º 1
0
 public List<Customer> GetCustomersList()
 {
     using (ExempleDbContext context = new ExempleDbContext())
     {
         context.Database.Log = x => Debug.WriteLine(x);
         var result = from c in context.Customers
                      select c;
         return result.ToList();
     }
 }
Ejemplo n.º 2
0
        public IQueryable<Customer> GetCustomers()
        {
            //It's only un exemple ,don't use in normal development
            ExempleDbContext context = new ExempleDbContext();
            context.Database.Log = x => Debug.WriteLine(x);
            var result = from c in context.Customers
                         select c;
            return result;

        }
Ejemplo n.º 3
0
        public IQueryable<Order> GetOrders()
        {
            ExempleDbContext context = new ExempleDbContext();

            context.Database.Log = x => Debug.WriteLine(x);

            var result = context.Orders;

            return result;

        }
Ejemplo n.º 4
0
 public Customer GetFirstCustomer()
 {
     using (ExempleDbContext context = new ExempleDbContext())
     {
        
         context.Database.Log = x => Debug.WriteLine(x);
         var result = from c in context.Customers
                      select c;
         return result.FirstOrDefault();
     }
 }
Ejemplo n.º 5
0
        public Order GetFirstOrder()
        {
            using (ExempleDbContext context = new ExempleDbContext())
            {

                context.Database.Log = x => Debug.WriteLine(x);
                //Need to include the sub object
                var result = context.Orders.Include("Customer").Include("OrderDetails");
                return result.FirstOrDefault();
            }
        }