DevTeach Day 2 – LINQ to Everything
Before I post about DevTeach Day 3 I thought I’d report back how the LINQ session I did yesterday evening. I mentioned yesterday that I volunteered to fill in for Roy Osherove because he ended up in the hospital. Good news is that he emailed this morning and he was released with some medicine, so he should start feeling better soon.
I called the session LINQ to Everything. For winging a LINQ session I think it went extremely well. As a matter of fact I’ll probably polish it up a bit more and use it again in the future. I decided there should be a simple agenda and then encourage a lot of interaction and questions from the crowd to shape the talk and mold the examples. It worked well. I started with explaining at a high level the LINQ framework architecture and what major LINQ providers were available in Visual Studio 2008, but also mentioned LINQ to Entities that is available in SP1.
Next up LOTS of samples. I had a question about LINQ to Objects and showed how to query all the processes on my machine. Then I moved quickly to a data discussion (what do you expect from a business programmer ;-)) showing LINQ to SQL and LINQ to Datasets pointing out the differences to each approach and the considerations you have to think about when going n-tier.
Finally I ended with a discussion on LINQ to XML (my personal favorite). I typed some XML into the editor, pointed out the XElelment and XDocument classes and the benefits they have over the XML DOM, enabled IntelliSense, queried the document and transformed the results. We were running out of time but I promised some Office Open XML tips. So I asked the crowd if we should write an Excel data app or a Word letter generator and they wanted to see how we could quickly text merge Word documents. I have an example I showed before here.
I think it went really well and the evals coming through today are validating that. LINQ makes it easy to get great marks on a session because the technology is so fun to work with :-). Here are the links I gave everyone.
LINQ to SQL examples:
LINQ to XML examples:
I’m now sitting in a cool WPF data binding session so I better pay attention. I plan on doing a series of How Do I videos on WPF data-based development so I want to compare notes with the experts. I’ll report back after my VB6 to .NET Migration talk I’m doing later with Rob Windsor.