Tuesday, July 15, 2008

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

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

Soumitra Sengupta Explains Issues with Aligning SSDS and ADO.NET Data Services APIs

Soumitra’s Why Astoria alignment is not that trivial post of July 14, 2008 describes the pain points of aligning the SQL Server Data Services (SSDS) and ADO.NET Data Services (Astoria) APIs to simplify the transition from off-premises (cloud) to on-premises (or vice-versa) implementations of SQL Server. Following are my paraphrased versions of his three primary issues:

  1. Single (Astoria databases) versus multiple (SSDS containers) consistency domains raise issues with cross-container queries, inter alia.
  2. Multitenancy (SSDS) versus single tenancy (Astoria) require different security models.
  3. Astoria with the Entity Data Model (EDM) as the data layer requires schemas; SSDS doesn’t (but optional EDM or EDM-like schemas are planned)

Readers of this blog know I’ve been lobbying for more background details about the promised alignment of the SSDS and ADO.NET Data Services (Astoria) clients since Francois Ajenstadt, then director of project management for SQL Server, said in early March 2008: "The goal is to bring the APIs between SSDS and Astoria closer together closer to Release." Soumitra’s post is a step in the right direction.

Note: Gianpaolo Carraro, who wrote the preceding definition of multitenancy, is Director of SaaS Architecture, in the Architecture Strategy team at Microsoft. Gianpaulo’s blog is a very useful source of architectural data about Software as a Service and cloud computing. His Cloudy Future for the Enterprise and most likely for ISVs too post of June 19, 2008 is a good starting point.

Added: 7/15/2008

Marcelo Lopez Ruiz Reviews Support for the $value Keyword by ADO.NET Data Services

Marcelo originally discussed the $value near the end of his Service Operations in ADO.NET Data Services post of January 8, 2008. In his ADO.NET Data Services support for $value post of January 13, 2008, Marcelo digs deeper into the use of $value:

Let's say that customers have a "CompanyName" property. A URL such as service.svc/Customers('ALFKI')/CompanyName would refer to a resource that is an XML document with a single element called CompanyName, enclosing the value. The service will also accept service.svc/Customers('ALFKI')/CompanyName/$value, in which case the representation for the resource is just the value for the company name, with a MIME type of text/plain.

Added: 7/15/2008

Ruby Developer Has Doubts About Google App Engine

The July 14, 2008 Test Drive Google App Engine post by Juixe Software cites issues with GQL, which was “more strict and temperamental” than SQL, case sensitivity of table names, and indexes that you must define and then wait “anywhere from a few minutes to hours” to build. Juixe concludes:

This experience has t[a]ught me that learning a new platform requires learning a whole new set of known issues and limitations, and to discover new ones in the process. Anyone eager to deploy a web application on a new framework is a masochist.

Added: 7/15/2008

Eric White Shows You How to Reduce Bugs in LINQ to XML Code for Modifying XML Trees

His Writing Robust LINQ to XML Code that Performs Well post of July 13, 2008 begins:

I've made a few observations about how to write LINQ to XML code when modifying an XML tree in such a way that it becomes harder to introduce bugs.  In addition, I've also mentioned a couple of other points that you can take into consideration - you can write code that performs better if you know a bit about how LINQ to XML operates under the covers.

And offers links to three examples that use LINQ to XML to modify Open XML documents.

Added: 7/15/2008

Sybase to Release SQL Anywhere 11 in July 2008 with LINQ and Entity Framework Support

From the “Better Late Than Never Department”

A Sybase press release dated June 2, 2008 and issued at Tech*Ed Developers 2008 announced:

SQL Anywhere 11 provides several new key features for .NET developers:

  • Entity Framework and LINQ support
  • ADO.NET 3.5 Provider
  • Visual Studio 2008 Integration
  • .NET CLR stored procedures
  • Integrated full-text search and regular expression search

SQL Anywhere 11 general availability is currently scheduled for July 2008.

Prior to the release date, developers can download the Panorama beta build.

Sybase was mentioned in the “Updated Third-Party EntityClient Data Provider List” topic of my LINQ and Entity Framework Posts for 6/5/2008+ post as being “available within three months of the Entity Framework's RTM date.” However, the iAnywhere folks appear to be releasing a production managed data provider for a technology that’s still in beta.

Added: 7/15/2008

Kris Andersson Raises Issues with LINQ to SQL’s Handling of Grouped Queries with Multiple Aggregates

One of the problems with LINQ to SQL (and Entity Framework) is generating sub-optimal T-SQL syntax for “edge case” queries. (O/RM developers often use the term “edge case” for any query construct that generates poorly performing SQL.) As Kris points out in his Application Architecture - Part 4 - Data Access Layer - LINQ and Linq2SQL Links post of July 14, 2008 that:

[LINQ to SQL has a few] childhood diseases. … One of those is that grouped queries with multiple aggregates are less than optimal; the Linq2SQL provider translates such queries into one subquery for each aggregate resulting in poor I/O statistics.

Microsoft Regional Director Steven Forte, who’s a member of the newlyformed Data Programmability Group’s Advisory Council, has similar concerns. (See the “Stephen Forte Embraces the Impedance Mismatch” topic that follows.

However, Kris points out that Matt Warren’s Part X – GroupBy and Aggregates post of July 8, 2008 has the potential to solve the multiple aggregates problem by eliminating subqueries altogether. However, Kris shares my concern that LINQ to SQL might on life support and heading for the hospice.

Update 7/15/2008: Reworded first paragraph for clarity.

Stephen Forte Embraces the Impedance Mismatch

From the “How Did I Miss This?” Department

Poor-quality autogenerated SQL is just one of the issues that Stephen Forte raised in his Impedance Mismatch post of June 27, 2008 (following the “ADO.NET Framework Vote of No Confidence” ruckus.) Steve isn’t sanguine about the prospects for solving the object-relational “impedance mismatch” with O/RM tools. Steve says:

The ironic thing I’m now seeing is developers who are lazy and don't want to learn SQL using tools that will produce SQL for them. The SQL is bad, and now those same anti-SQL lazy developers are struggling to read pages of generated and near-unreadable SQL trying to solve performance problems. They’re dealing with SQL that’s more verbose and orders of magnitude harder to understand than what was needed in the first place! …

What I am saying (and have been saying for a long time) is that we should accept, no, embrace the impedance mismatch!  While others are saying we should eradicate it, I say embrace it.

ORM tools should evolve to get closer to the database, not further away.

Steve’s dismissal of O/RM tools in general and adoption of a data-first stance in particular makes me wonder why he’s on the Data Programmability Group’s Advisory Council whose other members predominately advocate domain-driven design.

Credit: I found the preceding thanks to a link from Kris Andersson’s post above to Jonas Follesoe’s ORM – We’re still stuck in Vietnam post of July 1, 2008 that contained a link to Steve’s post. Both posts have been added to my Current Commentary About the “ADO.NET Entity Framework Vote of No Confidence” Manifesto list.

Matt Warren Continues His IQuerable Coding Rampage with Part 11

Matt’s LINQ: Building an IQueryable Provider - Part XI post of July 14, 2008 is drawing near the finish line. This episode covers:

  • More Query Operators
  • Distinct
    • Skip, Take,
    • First, FirstOrDefault,
    • Single, SingleOrDefalut
    • Any, All
    • Contains
  • Framework Methods and Properties
  • Parameter[ized Queries]
  • Simpler Queries
  • Compiled Queries
  • Unit Tests[!]

Matt says, there’s “More posts to come.” The question now is: “Who will be first with a third-party, LINQ to SQL-enabled data provider?”

The ADO.NET Team Completes the EDM Tools Series with Part 4 for EdmGen2.exe

The EDM Tools | Options (Part 4 of 4) post of July 14, 2008 says:

Now, we combine the code examples in the preceding parts, along with a few extra functions, to make a command-line tool we’ll call EdmGen2.exe.

EdmGen2.exe is similar in functionality to EdmGen.exe, but understands how to read & write the EDMX file format.

EdmGen2.exe’s source code is available from the MSDN Code Gallery.

Scott Guthrie Finally Surfaces with the “Higher Level Features” Added by ASP.NET MVC Preview 4

Following a one-month+ hiatus, Scott’s ASP.NET MVC Preview 4 Release (Part 1) post of July 14, 2008 begins:

The ASP.NET MVC team is in the final stages of finishing up a new "Preview 4" release that they hope to ship later this week.  The Preview 3 release focused on finishing up a lot of the underlying core APIs and extensibility points in ASP.NET MVC.  Starting with Preview 4 this week you'll start to see more and more higher level features begin to appear that build on top of the core foundation and add nice productivity.

There are a bunch of new features and capabilities in this new build - so much in fact that I decided I needed two posts to cover them all.  This first post will cover the new Caching, Error Handling and Security features in Preview 4, as well as some testing improvements it brings.  My next post will cover the new AJAX features being added with this release as well.

And then goes on for several feet of illustrated demonstrations of Filter Interceptors and the following filters: OutputCache, HandleError, and Authorize. There’s also an AccountController class and help for unit testing TempData.