AWDNUG - September Meeting

written by Andrew Tobin on Thursday, September 13 2007

Well, as Mabster has already posted, last night I gave a fairly rushed presentation of what is coming in Visual Studio 2008 and a bit of an overview of LINQ to Objects and LINQ to SQL, stealing liberally from Scott Guthrie's recent posts.

I think it was pretty well received, I was a fair bit more confident presenting last night, even though I don't get the opportunity to program in .NET too often, and I only have a few weeks on the subject.  A lot of the guys seemed to be fairly interested and there was quite a bit of discussion going on.

Being the day after I have already had a few messages back and forth with Matt on the next things we'd like to test on LINQ, and we seem to be pretty much following the same wavelength.

Actually one thing I just did was started a new winforms application, dropped a datagrid and a binding source on the form, added a LINQ to SQL class to the project, and dropped a table onto the design surface.

Then I put a LINQ Data Context object into the class, so that it was global to the class, and in the Load event I put some simple code to bind the datagrid to a LINQ query.

var people = from p in dc.Peoples
    select p;
peopleBindingSource.DataSource = people;

From there I also put a dc.SubmitChanges(); against a save button.

The datagrid nicely handles all the delete, update and adds to the database table, and the submit saves it all back nicely.

I'm loving LINQ quite a bit, it seems a lot easier to deal with than Datasets.

Now I'm sitting with the same question that Matt posed, how do I merge changes back in if I am using LINQ to SQL in a Web Service, or can I just pass back changed rows, to the Web Service for update, etc?

Anyway, I recommend going back and starting to read Scott's series on posts on this topic which begins with the "Orcas" Language Features, and also his great video on setting up LINQ with ASP.NET and the datagrid.

No word as yet on what's being presented next month, but hopefully it wont be another year until I find something I feel fairly confident to present on again.

I'm attaching the code samples and powerpoint slides I used to this post.

Similar Posts

  1. SQL Code Camp - Day 1
  2. SQL Code Camp - Day 2
  3. Code Camp Oz 2008

Post a comment

Options:

Size

Colors