Thursday, August 30, 2007

LINQ and Entity Framework Updates for 8/29/2007+

Video: ADO.NET Entity Framework - One Year Later

Pablo Castro, Britt Johnston and Michael Pizzo celebrate the first anniversary of the ADO.NET Entity Framework (EF) with a 34-minute Channel9 video segment: ADO.NET Entity Framework - One Year Later. The trio's first EF presentation was ADO.NET Entity Framework: What. How. Why., which was posted on September 1, 2006. (The August 29, 2007 posting date on the introduction page is a recent artifact; the 2006 date is from a Google cache of the page.)

Michael Pizzo, chief architect of the SQL Server Data Tools team that's in change of the EF project admits that the first release won't be fully persistence ignorant (03:30), but it's an improvement over previous CTPs and will be addressed in the next version. Pablo Castro gives a demonstration of the Entity Data Model (EDM) Designer starting at 21:00 and discusses how EF fits into the Data Tools team's Astoria project at 28:00. (Update 8/31/2007.)

WCF with Data Layer in VS 2008 Walkthrough by the VB Team

A Walkthrough of WCF Support in Visual Studio 2008 ordinarily would be off-topic for this post because it uses a strongly-type DataSet in its data layer. However, it's easy to substitute LINQ to SQL Table<TEntity> objects for the DataSet's DataTables. If you haven't created and consumed [Web] services with the Windows Communication Foundation (WCF), this post is a good introduction. (Update 8/31/2007.)

Entity Framework Beta 2 and EDM Tools CTP1 Docs Redux

You can read the online documentation for the Beta 2 and CTP1 bits here. The problem reported in the ADO.NET Entity Framework August 2007 CTP for VS 2008 Beta 2 Runtime and Tools Available post was a bad URL. Tommy from the Data Tools team confirmed in a comment that there were early problems opening the docs. (Update 8/31/2007.)

Julie Lerman and the Entity Framework's Former Span Keyword

Julie's 8/30/2007 Knocking off Danny Simmons Entity Framework Beta 2 List: #2: Span post announces that span has been replaced by the Include("AssociatedObjectName")[.Include("AssociatedObject2Name")...] ObjectContext method to return associated objects with the target object[s].

What disturbs me about this approach is introducing late-binding into the ordinarily early-bound (and thus compiler-checked) LINQ to Entities query.

Backstory: Matt Warren coined for Object Spaces the term span for a property that determines eager loading (pre-fetching) of associated objects. Matt says in his March 15, 2004 ObjectSpaces: Spanning the Matrix post:

ObjectSpaces has had the span parameter, and yes the name derives from my own ultra-nerdiness. It refers to the [linear] span of a [vector] space as used in linear algebra. Crack a book if you don’t believe me. [Clarifications and link added.]

(Updated 8/31/2007.)

Bart De Smet and New VB 9.0 Language Features

He's more than half way through this list of topics: 

(Updated 9/1/2007.)

Mike Taulty Organizes Links to his Recent Entity Framework Posts

His ADO.NET Entity Framework - Bringing Together A Few Previous Posts of 8/29/2007 provides a single page of links that's similar to my previous list but organized by topic.

Julie Lerman and the Entity Framework's New Complex Types Feature

Julie Lerman gives complex types a test drive with AdventureWorks LT in Knocking off Danny Simmons Entity Framework Beta 2 List: #1: Complex Types. Complex types combine related properties (such as streetAddress, city, state, postalCode and country) of a reference type (such as an order or customer) into a new type that becomes a single property (address) of the reference type.  Martin Fowler calls them value objects. He describes them as:

A small simple object, like money or a date range, whose equality isn't based on identity, ... instead two value objects are equal if all their fields are equal.

A general heuristic is that value objects should be entirely immutable. If you want to change a value object you should replace the object with a new one and not be allowed to update the values of the value object itself - updatable value objects lead to aliasing problems.

Value objects usually are represented in C# as a struct rather than a class. They have no identity beyond their values, so you can have multiple copies of them in memory. Danny Simmons discusses them in his 6/16/2007 Non-scalar Value Objects aka "Complex Types" post. My June 17, 2007 Entity Framework: Complex Types Redux in Beta 2 post discusses complex types in greater detail. (Updated 8/31/2007.)

Note: AdventureWorks' Person.Address and Sales.CustomerAddress types are reference types because their identity is the primary key of the persisted object.

Ben Hall on LINQ to SQL Files plus a LINQ in Action Review

For those new to SqlMetal.exe, Ben Hall describes the files it creates in his 8/20/2007 The power of SQLMetal post. His 8/28/2007 What are the files the Linq to SQL designer creates? post does the same for the O/R Designer.

Ben also gives a favorable review of the forthcoming LINQ in Action book by Fabrice Marguerie, Steve Eichert and Jim Wooley. It's currently available as an eBook in Manning's Early Access Program.

More SQL Server Compact Edition Beta 2 Releases

Now that LINQ to SQL semi-supports SQL Server Compact Edition, I'll be adding coverage of it to these weekly summaries. Microsoft India's SSCE team posted SQL Server Compact 3.5 Beta 2 Downloads on 8/30/2007 with links to the runtime, tools, and Books Online for the database engine and Microsoft Synchronization Services. For LINQ to SQL developers, SSCE's most important new feature is the timestamp (rowversion) data type.


Anonymous said...


I've actually emailed the DP team to ask about the use of the string in the LINQ query and if they can't just leverage the schema that LINQ is already aware of.

I'm hoping that the use of the string is just their first pass? (Ever the pollyanna)