Sunday, April 05, 2009

LINQ and Entity Framework Posts for 3/30/2009+

Note: This post is updated daily or more frequently, depending on the availability of new articles.

Entity Framework and Entity Data Model (EF/EDM)

James Terwilliger, a PostDoc researcher at Microsoft Research, delivers EDMGen2 – Now with Reverse Engineering options, an updated version of EDMGen, on 4/4/2009:

The new version of EdmGen2, recently released on Code Gallery, includes an option “RetrofitModel”. This extension is the result of collaboration with the database team at Microsoft Research, notably summer intern Ankit Malpani. When using this option, EdmGen2 uses data mining techniques to determine if there are TPH, TPT, or vertical partitioning relationships that are inherent in the instance. It then generates a suitable model and mapping in the form of csdl, msl, ssdl, and edmx files.

Mohammed Meligy’s Typed Eager Loading Using Entity Framework (& What is Eager Loading vs Deferred Loading) - Guru Stop post of 4/2/2009 ploughs this fertile ground for those uninitiated in EF’s loading of associated objects.

Gil Fink tackles Supporting Stored Procedures that Return Primitive Types in Entity Framework and Entity Framework Mapping Helper on 4/3/2009 and Creating Complex Types in Entity Framework on 4/2/2009

Alex JamesTip 10 - Understanding Entity Framework jargon of 4/2/2009 translates nine common EF-related abbreviations and acronyms.

Julie Lerman delivers An FAQ about EF/Astoria/LINQ to SQL: Is the data filtered on the server or on the client? on 4/1/2009 observes:

There are people who are concerned that the filters don't get applied until after the data has been returned from the server.

I happen to be one of those people.

Julie Lerman reminds folks in her Using Pre-Compiled LINQ to Entities Queries in Web Apps and Services post of 3/31/2009 about Brian Dawson’s earlier posts about query performance:

  1. Exploring the Performance of the ADO.NET Entity Framework - Part 1
  2. Exploring the Performance of the ADO.NET Entity Framework – Part 2
  3. ADO.NET Entity Framework Performance Comparison

and then adds a few of tricks from other performance types on the ADO.NET team.

Simon Segal’s Entity Framework Profiler – When .ToTraceString() just isn’t enough! post of 3/30/2009 describes how he “set out to build an Entity Framework Profiler to try to address the dislocated nature of having to switch between viewing output from .ToTraceString(), SQL Profiler and LINQPAD.”

Binary Bob compares Julie Lerman’s and John Papa’s approaches to data updates with Entity Framework in Silverlight apps in his 3/25/2009 Disconnected Clients, Changed data and Entity Framework post:

    • Julie Lerman (Programming Entity Framework) goes so far as to create DTOs for each Entity which are passed back and forth over the wire (DTOs are smaller than Entities and can be used by a wide range of clients who do not need to know anything about Entity framework). There is considerable work required in this solution though.
    • John Papa (Data-Driven Services with Silverlight 2) does indeed pass the serialized entities over the wire and then “reattaches” them to the data context and manually sets all the modified properties on the Entity in the update service’s code. The the SaveChanges() method is called to save the updates.

and goes on to suggest:

If you are willing to use Restful techniques as implemented in ADO.Net Data Services, you need not worry about handling changes in server code as ADO.Net Data Services can handle the changes as the changes are in the HTTP request (using the PUT verb), not in serialized Entities. If you are worried about data being sent in clear text (which you should be) then use SSL.


Gunnar Peipman solves Problem when testing LINQ To SQL Classes objects on 3/30/2009 that arose as the result of caching problems:

It turns out that for testing we should also dispose DataContext after each operation so we don’t face caching problems when we want to see if database operations work as expected.

LINQ to Objects, LINQ to XML, et al.

Simon Segal’s LINQ To XML and the Specification Pattern - [In a static world] post of 4/4/2009 continues his infatuation with the Specification pattern. Simon promises:

I am going to have a go shortly at putting together some variations of the Specification<T> class to allow for a more complete use with LINQ in General, remembering that the initial requirement was based around testing objects for equality and then creating a more manageable and malleable system of creating dynamic queries in LINQ To SQL and the Entity Framework. The “new” Specification class will need to support more than the just Func<T, bool> and should prove to be in interesting exercise.

Zeeshan Hirani offers seven “Tips for Delving in to LINQ” in his LINQ Deep Dive: Part I post for ASP.NET Pro Magazine’s April issue:

    1. Apply filters before a join to improve query performance
    2. Filter LINQ queries using object reference comparison
    3. Apply aggregates to empty collections in LINQ to SQL queries
    4. Delay loading a property in LINQ to SQL
    5. Use table-valued functions with eager loading turned on
    6. Put joins in the correct order in a LINQ to Objects query
    7. Compose a LINQ query inside a loop

Matthieu Mezil’s How to use LINQ extension methods on non generic IEnumerable? post of 4/1/2009 contends: 

LINQ extension methods are great but... it's not so cool when we use non generic collections as it is often the case with Sharepoint or TFS APIs.

and then goes on to “redefine LINQ extension methods for non generic IEnumerable.”

ADO.NET Data Services (Astoria)

Mike Flasko’s More on Web Friendly Feeds in ADO.NET Data Services v1.5 CTP1 post of 3/29/2009 offers pointers to Phani Raju’s posts about new Web-Friendly Feeds:

Mike Flasko offers guidance in Using ADO.NET Data Services v1.5 CTP1 with Silverlight 2 and Silverlight 3 in this 3/29/2009 post.

ASP.NET Dynamic Data (DD)

Steve Naughton’s Cascading Filters and Fields – Dynamic Data Entity Framework Version of 4/4/2009 begins:

I wanted to do this in EF and Preview 3 at the same time but I having an issue with that so I’m combining both the Cascading Fields and Filters together and when the bugs are ironed out of the Preview I’ll do it there also.

Miscellaneous (WPF, WCF, MVC, Silverlight, etc.)

Charlie Calvert explains why he’s interested in Silverlight in his Silverlight Revisited post of 4/2/2009:

  1. It allows me to create a rich interface with sophisticated visual techniques including animation.
  2. It provides a thoroughly modern programming model, and a set of rich API’s for performing common programming tasks.

Mike Flasko offers guidance in Using ADO.NET Data Services v1.5 CTP1 with Silverlight 2 and Silverlight 3 in this 3/29/2009 post. (Copied from the “ADO.NET Data Services (Astoria)” section.)