private static void OrdersPerEmployee()
 {
     using (NorthWindEntityContext cx = new NorthWindEntityContext())
     {
         foreach (var data in cx.Employees)
         {
         }
     }
 }
示例#2
0
 private static void IncreaseBeverageByEightPercent()
 {
     using (NorthWindEntityContext cx = new NorthWindEntityContext())
     {
         var cat = (from c in cx.Categories
                    where c.CategoryName == "Beverages"
                    select c).First();
         foreach (var p in cat.Products)
         {
             p.UnitPrice = p.UnitPrice * 1.08M;
         }
         cx.SaveChanges();
     }
 }
        private static void CustomersWithNamesLongerThan25Characters()
        {
            using (NorthWindEntityContext cx = new NorthWindEntityContext())
            {
                var names = from n in cx.Customers
                            where n.CompanyName.Length > 25
                            select n.CompanyName;
                foreach (var name in names)
                {
                    Console.WriteLine(name);
                }

                Console.ReadLine();
            }
        }