Пример #1
0
        private static void WithLinqSqlClassesConvertToXml()
        {
            var db  = new DataClassesConceptTestDataContext();
            var xml = new XElement("CustomerClasss",
                                   from x in db.Customers
                                   select new XElement("CustomerClass",
                                                       new XAttribute("CustomerId", x.CustomerId),
                                                       new XAttribute("CustomerName", x.CustomerName),
                                                       new XAttribute("City", x.City)));

            Console.WriteLine(xml);
            Console.ReadLine();
        }
Пример #2
0
        private static void WithLinqSqlClasses()
        {
            var db      = new DataClassesConceptTestDataContext();
            var results = from c in db.Customers
                          where c.City.StartsWith("M")
                          group c by c.City
                          into g
                          select new Result()
            {
                City  = g.Key,
                Count = g.Count()
            };

            db.Log = Console.Out;
            ObjectDumper.Write(results);
        }