Thursday, July 24, 2008

LINQ and Entity Framework Posts for 7/21/2008+

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

Updated 7/23/2008: Additions

Eric White Asks: Are Developers Using LINQ?

Erick wants to know:

  1. Do developers at your company understand and use LINQ?
  2. Do you?
  3. Can you see the benefit?

Leave the answers as a comment to his Are Developers Using LINQ? post of July 24, 2008.

Added: 7/23/2008

Pat Helland Returns to the SQL Server Team from Developer Division

Pat Helland, the champion of autonomous applications, announced his return to the SQL Server Group in his “Transferring to the SQL Team” post of July 23, 2008. He’s back after a hiatus at and a stint with Scott Guthrie and friends at the developer division.

If you missed Pat’s famous “Autonomous Computing: Fiefdoms and Emissaries” presentation at Tech*Ed 2002, you can peruse the PowerPoints here.

Pat says:

Now, it turns out there is a really special opportunity for me to join a team in SQL called SIA (Strategy, Infrastructure, and Architecture).  This spot allows me to work on the business, technology, architecture, infrastructure, and more for one of the industry's leading products.  It also allows me to participate in driving some of the new changes in scalable cloud computing (which is, of course, where I am extremely passionate). [Emphasis added.]

I think it’s safe to assume that “scalable cloud computing” = SQL Server Data Services (SSDS).

P.S. You might enjoy reading Pat’s A Weekend at Foo Camp post of July 16, 2008 about his stay at this year’s Foo Camp in Sebastopol, CA.

Added: 7/23/2008

Marcelo Lopez Ruiz Warns ADO.NET Data Services Developers About Stack Overflows When Testing Asynchronous Calls

In his Beware of stack overflows in asynchronous calls post of July 23, 2008, Marcelo discusses stack overflow errors when testing APIs of the ADO.NET Data Services client-side DataServiceContext. Marcello suggests:

The fix in my case was to schedule the next piece of work to be done rather than executing it immediately in the callback. Whenever you're doing these sorts of things, SynchronizationContext is your friend, which in Silverlight is implemented in DispatcherSynchronizationContext. The Post method allows you to queue up a piece of work (execute asynchronously).

Added: 7/23/2008

Damien Guard Offers Full-Featured T4 Template to Generate LINQ to SQL Classes

Damien’s Experimental LINQ to SQL template post of June 25, 2008 was an encouraging demo of how a T4 template might be used to customize generated LINQ to SQL class code. However, this early version was missing many features required to use the template for production projects.

His new LINQ to SQL T4 template reloaded post of July 23, 2008 takes the early version to completion with the following features:

  • Runs from the DBML therefore keeping the designer in the loop
  • Generates all the attributes for columns and tables including UpdateCheck, IsDbGenerated, etc.
  • Supports associations including those with a foreign key
  • Generates appropriate attributes and code for both serialization modes

The current version is C# only.

Added: 7/23/2008

Lawrence Jones Shows How the EDM Designer’s Update Model from Database Feature Works

Lawrence’s three-part series about the EDM Designer’s Update Model from Database operation explains “the reason behind some of [its] oddities” and answers some frequently asked questions about the feature:

Steve Naughton Starts ASP.NET Dynamic Data FieldTemplate Tutorial

FieldTemplates are a key feature of ASP.NET Dynamic Data. Following are the links to episodes of Steve’s three-part series about FieldTemplates:

Stephen A. Bolen Teaches NHibernate with a Series of Screencasts

Scott Hanselman extols the virtues of Stephen’s Summer of NHibernate Screencast Series in his Learn How to use NHibernate with the Summer of NHibernate Screencast Series post of July 22, 2008. Six episodes were available as of 7/22/2008.

Scott says:

I used NHibernate as my Data Layer recently when I got ASP.NET MVC running under .NET 2.0 using NHibernate examples from Davy Brion (who has an NHibernate Category on his blog).

NHibernate is very flexible, but it's a little overwhelming (for me, at least) to get started. Davy has a good "code-heavy" walkthrough of the concepts. Some NHibernate write-ups assume too much, IMHO.

Perhaps to combat this, Stephen Bohlen has created the Summer of NHibernate Screencast Series as a learning tool to educate engineers at his company.

Stephen says:

"Often, our strategy for bringing people up to speed on [NHibernate] has been to rely on word-of-mouth and osmosis (often via pair-programming) to get the points across, but now we have a planned staffing ramp-up of a magnitude that will likely make that approach unwieldy."

The screencasts give you deep insight into the complexities of NHibernate and how it differs from LINQ to SQL and the Entity Framework.

Matt Hinze Delivers a Step-by-Step Tutorial for Checking Out and Testing LINQ to NHibernate

Matt’s Linq to NHibernate in 10 minutes post of July 22, 2008 provides the steps you need to test the current release of LINQ to NHibernate from SourceForge’s NHContrib project with Jeffrey Palermo’s sample CodeCampServer project.

Here’s the Tortoise Repository Browser displaying the NHibernate.LINQ source folder:

Note: You must register for a SourceForge account before checking out projects.

Daniel Leiszen Addresses LINQ4SP’s Query Evaluation to CAML Queries

In LINQ4SP Query Evaluation of July 22, 2008, Daniel explains that some LINQ expressions can’t be converted to SharePoint CAML expressions. In this case, the query must be broken into a CAML query that can be executed on the SharePoint server and LINQ expressions executed on the client.

Daniel Crenna Proposes a Pattern for Layering LINQ to SQL and WCF for Silverlight

In the first of a multipart series, LINQ + WCF + Silverlight (Part One) of July 21, 2008, Daniel adds two lightweight classes, AdventureWorksRepository and AdventureWorksUnitOfWork, to those generated by the O/R Designer “to create a functional data layer.”

Gianpaolo Carrera Posts a One-Hour Webcast About SaaS for Enterprise and ISV Architects

Gianpaolo’s Software + Services for Architects Webcast post of July 21, 2008 provides a link to his one-hour SaaS for Architects Webcast with emphasis on Microsoft’s cloud-based services and includes two of its slides.

The first slide (Big Pharma topic) applies to enterprises “wanting to optimize [their] IT environment[s] by leveraging a heathy mix between on-premises, SaaS and cloud” operations.

The second slide targets “an existing ISV (LitwareHR topic) moving from ‘server based infrastructure’ (Win2k8, SQL, AD) to ‘cloud based infrastructure’ (cloud compute, cloud storage, cloud identity [and SSDS].”

Gianpaolo mentioned that Microsoft currently is installing 10,000 servers per month to their cloud.

C. C. Chai Finds a Paging Bug in SQL Server Data Services Async Queries

C.C.’s A bug in paging (SOAP interface)? post of July 21, 2008 in the SQL Server Data Services (SSDS) - Getting Started forum spotted a problem paging asynchronous queries: The first group of results returns 499 instead of 500 entities. The SSDS team was able to duplicate the bug.

Shawn Wildermuth Uncovers Issues When Hooking ADO.NET Data Services to LINQ to NHibernate

In an earlier (July 20, 2008) post, Shawn finds Silverlight 2 + NHibernate.LINQ == Sweet. However, his NHibernate.LINQ with ADO.NET Data Services post of July 21, 2008 runs into Astoria’s “ID” bug, which Microsoft says will be fixed in the RTM version. You also must use a generic IList<T> for one:many associated entities.

Shawn also notes Ayende Rahien’s reservations about “availability and scalability on the operations side, and schema versioning and adaptability on the development side” and cautions prospective users about Astoria’s lack of data security features.

Scott Hunter Summarizes New ASP.NET Dynamic Data Updates

Scott’s Many Updates on Dynamic Data post of July 21, 2008 describes updates to:

Steven Walters ASP.NET MVC Tips Include Data Layer Advice

Steve’s ASP.NET MVC posts include a series of tips for implementing this new technology. The following tips apply to LINQ to SQL:

Proposed New FunctionImports Flexibility in Entity Framework v2

Alex James’ Using Stored Procedures to load structured data post of July 18, 2008 describes plans to:

  • Allow FunctionImports to return unattached/untracked Entities
  • Allow FunctionImports to return ComplexTypes

    in Entity Framework v2. These features would supplement the EntitySet returned by FunctionImports mappings for scenarios where the entity or complex type returned by a stored procedure doesn’t require data tracking and updating.