Пример #1
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         db.Dispose();
     }
     base.Dispose(disposing);
 }
Пример #2
0
        public int OrderCount()
        {
            NorthwindDemoEntities entities = new NorthwindDemoEntities();
            int orderCount = entities.Orders.Count();

            entities.Dispose();
            return(orderCount);
        }
Пример #3
0
        public List <string> LastNOrders(int id)
        {
            NorthwindDemoEntities entities       = new NorthwindDemoEntities();
            int           numberOfOrdersToReturn = id;
            List <Orders> lastOrders             =
                (from o in entities.Orders orderby o.OrderDate descending select o).Take(numberOfOrdersToReturn).ToList();
            List <string> customerNames =
                lastOrders.Select(o => o.Customers.CompanyName).ToList();

            entities.Dispose();
            return(customerNames);
        }