In preparation for my (6) code camp talks next weekend, I'mupdating my samples. One thing that's changed slightly is the LINQ syntax. The code below thumbs through the Northwind database, and displays all customers in London, nesting the orders for each customer:

var orders = new XElement("CustomerOrders", new XAttribute("city", "london"),
        from c in db.Customers
        where c.City == "London"
        select new XElement("Customer", new XAttribute("id", c.CustomerID),
                             from o in db.Orders
                             where o.CustomerID == c.CustomerID
                             select new XElement("order", new XAttribute("id", o.OrderID))
                           )
                         );

The resulting XML looks something like:

<CustomerOrders city="london">
  <Customer id="AROUT">
    <order id="10355" />
    <order id="11016" />
  </Customer>
  <Customer id="BSBEV">
    <order id="10289" />
    <order id="11023" />
  </Customer>
  <Customer id="CONSH">
    <order id="10435" />
    <order id="10462" />
    <order id="10848" />
  </Customer>
  <Customer id="EASTC">
    <order id="10364" />
    <order id="11047" />
    <order id="11056" />
  </Customer>
</CustomerOrders>

There's more where that came from... My total talk gluttony includes talks on:

  • C# 3.0
  • WinFS (with Pete Orologas)
  • Creating Custom Controls for ASP.NET 2.0
  • Taking Advantage of Team System Version Control
  • Creating Team Foundation Server Add-ins
  • Using XLINQ

If/when you get tired of listening to me prattle on, other Neudesic speakers include Chris Rolon, David Pallmann, Steve Saxon, David Barkol, Brian Loesgen, Phil Scott, Robert Atland, and Ashish Agarwal.