The missing LINQ

I’ve been playing around with LINQ, in order to start moving toward CSLA version 3.5, which makes extensive use of LINQ.

So far, it’s been a fairly pleasant trip. The OR-Mapper included in VS 2008 links (linqs?) your object nicely together and it’s pretty straight forward to get started. Here’s a quick rundown of how to use it:

First download the Northwind Sample db here. Start a new Windows Application project and add a new connection to the db using the server explorer.

Next, add a new LINQ to SQL classes item to your project and call it Northwind.dbml. Drag the Customer table onto the designer, followed by the Orders table. Tada! It automatically adds an association, based on the relationships in your database, between the Customer and Orders tables/objects.

Everything happens behind the scenes, so if you right-click on the customer object and select View Code, it’ll take you to a partial class of Customer. In here you can add some custom properties and methods. All the CRUD operations are handled for you.

It’s all a still a bit "Black Box" for me, but the concept is excellent! If you start looking at Rocky’s implementation of it in CSLA 3.5, you’ll realize it’s pretty cool stuff.

I’ll post a couple of tutorials in the coming weeks about CSLA 3.5 as I figure stuff out. Check back soon!