Comment

Weekly Training - ASP.NET Dynamic Data

This week I ran a quick training session at SSW on ASP.NET Dynamic Data. I used the Developing Data Driven Web Applications Using ASP.NET Dynamic Data session that David Ebbo did at MIX08. Some nice take aways from this are:

  1. Very easy way of generating data entry pages for your tables
  2. Great for admin pages
  3. Template based so it’s easily customizable
  4. Rich relationships in your data grid
  5. Free filtering, sorting, paging, editing, deleting

Comment

Comment

LINQ to SQL with WCF - Lazy Loading and Caveats

Just a quick tip for those of you working with LINQ and WCF.

LINQ-to-SQL natively supports lazy loading as long as your entities are still managed by the DataContext. However, when you pass your entities across WCF your entities become detached from the DataContext so you can’t lazy load on the client side - which makes perfect sense.

The question is how do you then pass a LINQ entity and its child collections across WCF?

This is where the DataLoadOptions class comes in handy. This class allows you to specify exactly what child collections to load along with your entity.

Without this you would have to make two service calls - one to get the parent object and another to get the child collection.

Comment

Comment

The Aggregate method in LINQ

One little known and scarcely document feature of LINQ is its Aggregate method. This function is very useful when you want to do something to the whole collection.

Lets say I have the follwoing BlogEntry class

public class BlogEntry  
{ 
    public Tags { get; set; } 
}

Now what do I do if I want to build a tag cloud?

Comment