Friday, March 07, 2008

LINQ and Entity Framework Posts for 3/6/2008+

Note: Items for March 6, 2008 were moved from LINQ and Entity Framework Posts for 3/2/2008+ due to its excessive length.

MIX08: Introducing SQL Server Data Services (SSDS) Presentation

Nigel Ellis's BT08 Introducing SQL Server Data Services (SSDS) presentation to MIX08 is available online.

Added: 3/7/2008

Frans Bouma: The Final Chapter of the LINQ to LLBLGen Pro Journey

Developing Linq to LLBLGen Pro, part 14 of March 7, 2008 chronicles the completion of LINQ to LLBLGen Pro with an essay on eager-loading (pre-fetching) associated entities and the effects of optimizing eager-loading operations by tweaking queries. Frans cites an example where his optimized query runs 45 times faster than the corresponding (uncompiled) LINQ to SQL hierarchical fetch. Queries nested within projections run about 7 times faster in LLBLGen Pro.

Frans spent five to six months writing the 925 KB of C# source code for his LINQ implementation. I'm sure this is the largest investment made so far in LINQ by a third party. I'm equally sure that the investment will pay off for his LINQ to LLBLGen Pro O/RM tool.

Added: 3/7/2008

Ravi Tandon Demonstrates Entity Framework with SQL Server Compact Edition as the Data Source

The Entity Data Model might be a bit overweight for SQL Server Compact Edition (SSCE), but Ravi demonstrates in his My First Entity Application Against SQLCE post of March 7, 2008 how to entitize SSCE 3.5.

Ambrish Mishra's Download available for SQL Server Compact 3.5 SP1 Beta for ADO.Net Entity Framework Beta 3 post of February 21, 2008 has step-by-step instructions for installing SSCE 3.5 SP1 Beta and the Northwind.sdf database that's required by Ravi's demo.

Added: 3/7/2008

LINQ and Entity Framework-Related Sessions WMVs from MIX08

Wednesday Sessions Posted Thursday March 6, 2008

Additional day's sessions will be added as they become available.

Dave Campbell "Going Deep" Video Interview About SQL Server Data Services

Channel9's Dave Campbell: SQL Server Data Services and the Future of Data in the Cloud posted on March 6, 2008, carries this abstract:

Continuing with the Technical Fellow interviews on Channel 9, meet Dave Campbell. From his bio: "David Campbell is a Microsoft Technical Fellow working in the Data Storage Platform division where he is responsible for driving technical strategy and architecture of Microsoft SQL Server and other storage products. He also helps drive architectural alignment across Microsoft’s Server and Tools division. Campbell’s current projects and interests include extreme scale data processing and programmatic data services."

Dave spends relatively little time on the specifics of "Data in the Cloud," but concentrates on the history of relational database management system software and the architectural issues that arise when using industry-standard, low-cost hardware to host highly scalable data services with a simpler data model that's automatically or at least easily provisioned and structured data services as a middle tier.

Jeffry Zhao's Extension Method Enables Batch Deletion of LINQ to SQL Objects with a Lambda Function

Jeffry is an MVP and developer in China whose LINQ to SQL Extension: Batch Deletion with Lambda Expression post of March 6, 2008 includes a downloadable extension method that lets you substitute a Table<TEntity>.Delete() lambda function for SQL data manipulation language (DML) batch commands to delete multiple objects.

Jeffry's working on the extension method for a Table<TEntity>.Update() lambda function to handle bulk updates.

Bob Beauchemin Addresses LINQ to SQL/Entity Framework Worry Points 4, 5 and 6

Bob's MHO: LINQ to SQL and Entity Framework: Panacea or evil incarnate? Part 4 answers the next worry point:

4. LINQ to SQL and EF will write code that gets too much or too little data at a time. This is a variation of #2. Too much data in one query is a waste. Too little data is also bad because it means extra database round-trips.

with this conclusion:

So I'd say that this worry not only is completely unwarrented, but that LINQ to SQL and EF make programmers think more about lazy loading vs eager loading, and make it clearer and more maintainable than a join, which always returns an "anonymous rowset" with columns from all tables interspersed. That is, you know exactly what related data (at an object level) is being requested and retrieved.

MHO: LINQ to SQL and Entity Framework: Panacea or evil incarnate? Part 5 deals with:

5. LINQ to SQL and EF will discourage the use of stored procedures to return rowsets; returning rowsets in stored procedures is *thought to be* superior to returning them in dynamic SQL. In addition, the code generators will use a subset of T-SQL query constructs, that is, only the constructs that the LINQ or ESQL language supports, rather than the full power of the T-SQL query language.

and Bob concludes:

So I'd classify the "subset of SQL" and "stored procedure rowset is an anonymous type" problem as something that might be worked out in future releases of databases and frameworks. Until LINQ to SQL or EF provides escape clauses in the framework, the easiest way out is the ultimate escape clause, using the stored procedure that returns (anonymous) rowsets. And the more stored procedures are used (not CUD procedures, which enhance the model, but rowset-returning procedures), the farther away from the model you get. Which interferes with the usefulness of the model in general.

And, finally, MHO: LINQ to SQL and Entity Framework: Panacea or evil incarnate? Part 6:

6. LINQ to SQL and EF queries will be "untunable" because, even if you discover a performance problem, you can't change the underlying API code to produce the exact SQL query that you want. There's too many layers of abstraction to change it.

with Bob's "humble opinion:"

So, is this an issue worth worrying about? I think we'll need to wait and see. Fix a few "bad (generated) SQL or bad queries" problems before giving up entirely. Or, fix performance problems (in the generated SQL) by going to stored procedures and see how many procs you have after a year. Are the folks who are licking their chops in anticipation of LINQ/EF related perf problems justified? Well, its not me that thinks optimizing declarative languages will always have its place.

I'd say LINQ to SQL and the Entity Framework passed the scrutiny of a true SQL Server expert with a surprisingly high, but not perfect, score.

Click here to visit an earlier topic with links to worry points 1, 2 and 3.

Mary Jo Foley Interviews David Treadwell re the Windows Live Services Platform

Her Windows Live Platform Services: A guide for the perplexed post of March 6, 2008 casts additional light on the Windows Live Platforms Services layer is one of four sets of services. Probably the most important takeaway from the interview was:

Ozzie used multiple times during his keynote this week the word “mesh” in describing what Microsoft has coming on the consumer front.

“Mesh just means lots of different devices used in a cohesive way that leverage Web services when they make sense,” Treadwell said.

Microsoft’s two synchonization services — FeedSync and the Synchronization Framework are key to what the company will deliver on the mesh front, Treadwell said.

Steve Lasker's Sync Services for ADO.NET (Devices) CTP 1 Available for Download post of March 5, 2008 fills out the Sync Services clients to include support for Windows Mobile 5 and 6.

Treadwell was tight-lipped on most other Windows Live technologies.

Other Posts and Articles with SQL Server Data Services Details

My Spelunking SQL Server Data Services post of March 6, 2008 has the following deck:

Technical details about SQL Server Data Services (SSDS) are as scarce as hens' teeth, but following are posts about SSDS and/or competitive products by members of the SSDS team, other Microsoft employees, competitors, and relevant industry pundits that I'll be watching in case they spill some more beans.

It will be updated as new sources appear.

The Standard Bible Society Considers SSDS for Bible Software

The Standard Bible Society's What SQL Server Data Services Means for Bible Software post of March 5, 2008 compares SQL Server Data Services (SSDS) with Amazon SimpleDB and the CouchDB open-source document-oriented database as "possible way[s] to solve data portability and synchronization problems in Bible software." This use could provide an excellent demonstration of SSDS's capabilities.

The post quotes Craig Rairdin from Laridian, who spoke at BibleTech08 about “synchronizing user-created data between platforms, readers, and vendors” (mp3 of his talk):

In the last ten years, Bible software users have moved from being 100% desk-bound to nearly 100% mobile. Unfortunately, mobile devices are significantly more disposable than desktop systems, and users move from device to device, platform to platform, and Bible software to Bible software. Through this they long to have portability of not just their libraries but their own annotations, highlights, cross-references, bookmarks, and any other user-created data their programs allow them to create.

A combination of SSDS for data storage and retrieval with Windows Live Application Based Services for user-based annotations and other personal data might be the optimal solution. The question, of course, is how do you get users to pay SSDS fees?

Mary Jo Foley Gets It Right: SSDS Competes with Amazon's SimpleDB (Not S3)

Mary Jo can't get "Microsoft officials" to admit that SQL Server Data Services (SSDS) has any competitors, but her Microsoft launches its alternative to Amazon’s SimpleDB article of March 5, 2008 correctly identifies Simple DB not Simple Storage Services (S3) as the current data service that most closely resembles SSDS.

The article contains brief extracts of her interview at MIX08 with David Campbell, a Technical Fellow in Microsoft’s Data Storage Platform Division, about SSDS. For more about SSDS versus SimpleDB see the preceding topic and Spelunking SQL Server Data Services.

Julie Lerman Unearths the Elusive Silverlight DataGrid

I asked in a comment to Julie's Expression Blend with Silverlight 2.0 - Controls, controls, controls! post of February 29, 2008, "[W]here's the DataGrid control?" in her screen captures.

The answer is in her Silverlight's VS2008 Controls ...that's where the DataGrid is! post of March 6. It's in the integrated Expression Blend designer's toolbox when you open the designer in VS 2008's IDE!

I suppose that makes sense because you need a data source to use it but I bet a lot of folks are surprised not to see it in the standalone Blend UI.

Simon Evans Clarifies Service Contract Namespace and IIS Debugging Issues with WCF's JSON Format

If you're using JSON with ADO.NET Data Services and want to version a service contract that specifies JSON output or debug your service running on IIS, check out Simon's supplement, Consuming JSON enabled WCF 3.5 services using AJAX of March 6, 2008, to Fritz Onion's earlier article (see below).

Fritz Onion on JSON-Enabled Windows Communication Foundation Services

Dealing with JSON output from ADO.NET Data Services isn't as simple as using AtomPub. PluralSight's Fritz Onion explains the generic process in his Creating JSON-enabled WCF services in .NET 3.5 post of January 31, 2008.

Marcelo Lopez Ruiz on .NET DateTime versus JSON Date Ticks

Marcelo's System.DateTime.Ticks vs JSON Date post of March 5, 2008 explains the difference between date/time ticks for the .NET Framework and JSON data format.