using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { TextWriter log; log = File.AppendText("log.sql"); DataClasses1DataContext db = new DataClasses1DataContext(); db.Log = log; var query = from c in db.Customers select c; foreach (Customer cust in query) { Console.WriteLine(cust.ContactName); } log.Write("End of getting all customers query\r\n\r\n"); Customer alfki = db.Customers.Single(c => c.CustomerID == "ALFKI"); foreach (Order o in alfki.Orders) { Console.WriteLine("{0}:{1}", o.OrderDate, o.OrderID); } log.Write("End of getting all orders for alfki\r\n\r\n"); log.Close(); Console.ReadLine(); } } }