Sunday, August 31, 2008

LINQ and Entity Framework Posts for 8/25/2008+

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

Update 8/30/2008 to 9/1/2008: Additions and updates
Update 8/29/2008: Additions
Update 8/28/2008: Additions
• Update 8/27/2008: Additions
Update 8/26/2008: SSDS is back on line as of 13:30 PDT

Entity Framework (EF)

•••• Julie Lerman’s EF Business Classes in ASP.NET Apps - Don't pass that query around! post of 8/31/2008 recommends that developers using EF

Return Results, not Queries from the Business classes

by forcing iteration by invoking the ToList(), FirstOrDefault() or similar method, or looping through a foreach structure.

•••• Shawn Wildermuth dispels The Fable of the Perfect ORM on 8/30/2008. He points out that at least the following factors enter into the selection of the object-relational mapping tool:

  • Functional Requirements
  • System Requirements
  • Skill-set of the Development Team
  • Business Factors
  • Time-to-Market
  • Business Culture
  • Lifetime of Project
  • Volatility of Schema

Shawn goes on to give examples of criteria for using LINQ to SQL, NHibernate, LLBLGen Pro, or Entity Framework.

•••• Julie Lerman’s More on Foreign Keys in EF post of 8/30/2008 describes a partial class to return the scalar value of a foreign key from an EntityReference. Foreign key values are useful for specifying associations with dropdown lists. (LINQ to SQL delivers foreign key values by default.)

•••• Matthieu Mezil demonstrates in his EF and WPF post of 8/29/2008 part of the code required for a WPF master-details application that enables using a combo box to choose the master for the details window.

••• Julie Lerman finds EntityKeys are case sensitive in her 8/29/2008 post. Improperly cased keys and property names return

  • The member with identity 'NWentities' does not exist in the metadata collection.
    Parameter name: 'identity'
  • The required entry 'customerID' was not found in the provided input. This entry is required by the key fields defined on type 'NWModel.Customer'

exceptions, respectively.

••• Matthieu Mezil strikes again on the table-per-hierarchy inheritance model in TPH Is Not NULL mapped on a relationship of 8/29/2008.

Maíra Wenzel's Handling Null Database Values Using Data Source Controls tip of 8/28/2008 notes that:

This topic Handling Null Database Values Using Data Source Controls has now been updated on MSDN to fix the sample based on various customer feedback. You can still see the old version here, in case you're curious to compare both versions.

Her post provides the details on what changed.

•• Matthieu Mezil continues his investigation of strangenesses in EF’s processing of a simple query in his LINQ To Entities: stranger and stranger post of 8/28/2008.

Jacob Proffitt’s Changing Table Names in an OR/M post of 8/27/2008 explains how to change EF and LINQ to SQL table names to suit a particular naming convention in both O/RMs’ XML mapping files. Jacob finds changing table names in EF is more difficult than LINQ to SQL.

•• Tim Mallalieu partially answered my Availability of Minutes of First "Advisory Committee" Meeting? question on 8/27/2008 in the ADO.NET Entity Framework and LINQ to Entities (Pre-release) forum:

We will put something out which will be a recap of the findings.

We we still need to do the final post mortem internally and then publish.

It’s the timetable that’s missing.

ADO.NET Data Services (Astoria)

•••• Shawn Wildermuth’s My ADO.NET Data Services/Silverlight 2 Article on MSDN Magazine post of 8/31/2008 points to his “Create Data-Centric Web Applications With Silverlight 2” article for the “Data Services” section of MSDN Magazine’s September 2008 issue. Shawn says:

What is cool about this approach is that you can issue LINQ queries on the client (in Silverlight 2) that will communicate with Data Services via the REST interface and execute queries and update data on the server.  The substantial difference that you will have to get used to is the use of Asynchronous LINQ queries in Silverlight 2.  Check out the article for all the details.

Marcelo Lopez Ruiz adds his two-cents to the Astoria history book with his ADO.NET Data Services History of 8/28/2009.

Vardi posted his Data Service Viewer 1.0 WinForm source code to CodePlex on 8/27/2008. Vardi says:

ADO.NET Data Services Tool help[s] you to create the query URL and view the result.

Marcelo Lopez Ruiz points out that “DateTimeOffset and Time properties are not available as CLR types in ADO.NET Data Services” in his Gotcha with EDM types in ADO.NET Data Services post of 8/27/2008.

Marcelo Lopez Ruiz continues with the reasons to use EF as Astoria’s back end in his timed Another ADO.NET Data Service metadata tip post of August 26. (Marcelo is on a one-week vacation.)

SQL Server Data Services (SSDS)

•••• Roger Jennings recommended that SSDS and Other Windows Cloud Services Should Have Their Own Blogs on 8/30/2008, seconding Ayende Rahien’s proposal of the day before.

Niraj Nagrani, Soumitra Sengupta, and David Robinson deliver A Candid Look at SQL Server Data Services and the Business Scenarios it Addresses in an 8/28/2008 interview by Greg Hughes. The trio tackles the following topics:

  • SSDS isn’t a hosted instance of SQL Server in the cloud, it’s an Internet-based data utility powered by SQL Server
  • Target market is businesses who offer Sofware as a Service (SaaS) applications, including small and medium-sized businesses, with multi-tenancy as an important feature
  • Integration of authentication with the BizTalk Services Identity Provider will be rolled out in the “very near future.”
  • Symmetry with on-premises instances will be outside-in rather than inside-out.
  • SSDS have the capability to hand on-premises data to SQL Server Integration Services (SSIS) and pump it up to the cloud or vice-versa.
  • Microsoft Sync Services will make SSDS into a “data hub.”
  • SQL Server Reporting Services and Analysis Services will be used to deliver reports on uptime, performance and the like.
  • SSDS will grow to 5,000 nodes next year.
  • Open beta will occur shortly after PDC 2008 and SSDS will go live in the first half of 2008.
  • SSDS will be the preferred store of compliance data for large businesses.

•••• Dave Robinson says in SSDS Tech-Ed Online Video Posted of 8/29/2008 that the interview was conducted at Tech•Ed North America 2008, which was held in early June, so the “very near future” appears not so near after all.

•• Soumitra Sengupta discusses Jon Udell’s “continuum of access styles” as it applies to SSDS in his Jon Udell cURL's with SQL Server Data Services post of 8/27/2008.

I’m not sure if just REST and SOAP as wire formats for queries constitute a “continuum,” but supporting AtomPub, JSON, and POX as wire formats as promised might qualify.

Jon Udell’s The continuum of access styles in the emerging Microsoft cloud post of 8/27/2008 mentions his ability to use cURL for basic SSDS navigation with the REST query protocol. Jon concludes:

Microsoft platforms have not historically encompassed the continuum of access styles. Happily, the emerging cloud does. And while the novelty of “just coding to a URL” on a Microsoft platform will undoubtedly attract some tirekickers who otherwise wouldn’t show up, the real draw will be the ability to exercise choice along the whole continuum.

That choice, by the way, is not only relevant to developers accessing hosted, web-facing services. It will matter as much — and with the SOAP option, even more — to developers accessing on-premises services behind the corporate firewall and across corporate boundaries. Facing outward or inward, you’re most productive when you can choose the right access style for the job at hand. Between the realm of the 100% Microsoft coder and the 0% Microsoft coder, a wide and fruitful middle ground is opening up.

Ryan Dunn complements Eugenio Pace’s Concurrency in SSDS post of 8/1/2008 for the SOAP protocol with Concurrency with SSDS via REST of 8/26/2008.

•• Mike Amundsen recounts his problems during the outage in the SSDS is unavailable for all beta users? (2008-08-26 06:00 PDT) [Resolved] thread in the SQL Server Data Services (SSDS) - Getting Started forum.

Roger Jennings’ SQL Server Data Services Beta Encounters First Major Unscheduled Downtime post describes the approximately 7.5 hour unscheduled outage that occurred on August 26, 2008. From the post:

The SSDS team is to be commended for keeping testers up to date on the progress of bringing the service back up. Their response contrasted with Amazon’s failure to alert customers of their February outage, as reported in Amazon Web Services Outage: Causes And Remedies of 2/16/2008.

•• The preceding post has been updated for subsequent events and blog posts and was moved to a separate post due to its increasing length.

Gianpaolo Carraro’s Multi Tenant Data Access (MTDA) Blueprint post of August 25, 2008 announces the availability of the MDTA Blueprint on CodePlex and a Channel 9 interview with Eugenio Pace, the developer. Here’s part of the description:

The Multi Tenant Data Access (MTDA) Blueprint, part of the Software-plus-Services Blueprint program, provides guidance on writing a SQL Server based, single instance, multi-tenant data access layer similar to that used in LitwareHR sample application (SQL Server version).

You need the S+S Blueprints Manager from CodePlex to install the MTDA blueprint. (I was unable to use it with my installation of VS 2008 SP1.)

Note: This blueprint doesn’t use SSDS, as far as I can determine so far.

ASP.NET Dynamic Data (DD)

•• Matt Berseth goes hog wild with home-page menu customization in his A Dynamic Menu For Your Dynamic Data post of 8/27/2008. Matt says:

I have my tables organized into 4 categories: Sales, People, Products and Reports.  And the cool thing is that this menu is completely dynamic.  You can add, remove or reorganize the categories without touching the UI.  And depending where you are keeping your metadata you could even do this without recompiling your app.  The grouping is automatically discovered from the metadata and the menu is built solely off the it so everything 'just works'.

Besides adding the grouping information, I also tagged each of my tables with a custom description that I am displaying under the grids title.  Nothing too complicated, but still interesting.

LINQ to SQL

•••• Damien Guard’s T4 template update for LINQ to SQL in his original post of 8/29/2008 was premature. The latest version will add:

  • Inheritance support
  • VB.NET generation
  • DataContract serialization

But it won’t support stored procedures or composite primary keys.

An updated link in future issue of this post will be provided when the template is fully cooked.

Rob Conery’s Working With Linq's Expression Trees Visually post of 8/29/2008 shows you how to extract and install the Expression Tree Viewer add-in from the CSharpSamples.zip file and use it to view LINQ to SQL expression trees.

•• See Jacob Proffitt’s Changing Table Names in an OR/M post of 8/27/2008 in the “Entity Framework” section.

Simon Segal explains how POCO improves inheritance for LINQ to SQL in his lengthy post of 8/26/2008. He promises:

I will shortly be posting a framework that makes working in a POCO and DDD style much simpler. The Framework includes implemented Specification Patterns, Fetching Strategies and Extensible Repositories for your LINQ To SQL pleasure.

Jeff Atwood recommends adding the NOLOCK statement to SELECT queries to solve a mysterious deadlock problem with LINQ to SQL in his Deadlocked! post of 8/25/2008.

Jonas Stawski recommends being extra-careful when Recreating Entities with Linq To SQL in his 8/25/2008 post.

LinqMaster uncovers an arcane bug with insert triggers and provides a workaround in LINQ to SQL Database Trigger Bug – Workaround of 9/25/2008.

Rico Mariani answers questions by readers of his LINQ to SQL performance analysis series in Linq Compiled Queries Q&A of 9/25/2008.

LINQ to Objects, XML, et al.

••• Bart De Smet goes into excruciatingly detailed coverage of the use of SOS (a.k.a. “Son on Strike”) with dynamic expression trees in his lavishly illustrated To Bind or Not To Bind – Dynamic Expression Trees – Intermezzo: SOS in Visual Studio. Bart says:

In this post I want to point out that you can actually live without that visualizer and go the hard-core way using SOS, … the WinDbg extension for managed code debugging that ships with the .NET Framework (sos.dll). A little-known fact is that SOS can be loaded directly in Visual Studio through the Immediate Window.

•• Martin Hinshelwood says LINQ to XSD is “Absolutely brilliant” in his LINQ to XSD post of 8/28/2008. I’d say the LINQ to XML team would be “absolutely brilliant” if they posted a LINQ to XSD release version instead of Alpha 0.2.

• Bart De Smet’s second post of 8/27/2008, To Bind or Not To Bind – Dynamic Expression Trees – Part 2, delves into IL generation, expression compilation, and emitting code .

Bart De Smet continues his dissertation on dynamic expression trees with To Bind or Not To Bind – Dynamic Expression Trees – Part 1 of 8/27/2008 by creating a DynamicExpression abstract class with MethodCallDynamicExpression, LambdaDynamicExpression and ParameterDynamicExpression factory classes.

Jared Parsons uses a LINQ to XML-powered word-wheel application to demonstrate how to “Increase LINQ Query Performance” in his “Basic Instincts” column for MSDN Magazine’s August 2008 issue.

Ira’s LINQ Distinct, a DataTable and the IEqualityComparer<T> post of 8/26/2008 describes how to write a custom IEqualityComparer<DataRow> for LINQ to DataSet to enable the Distinct() operator to operate on entire rows instead of a single designated column.

Bart De Smet’s To Bind or Not To Bind – Dynamic Expression Trees – Part 0 post of 8/26/2008 is the start of a new series about building dynamic expression trees.

SQL Server Compact (SSCE) 3.5 and Sync Services

No SSCE/Sync Services posts to date.

Visual Studio 2008 Service Pack 1 (General)

• Mike Taulty’s Final .NET Client Profile ( 3 ) post of 8/26/2008 points to his WPF, ClickOnce and the .NET Client Profile Channel9 video of the same date with this description:

A simple demo of building a "Hello World" application with Visual Studio 2008 Service Pack 1 and then deploying it via ClickOnce to a clean Windows XP machine using the .NET Client Profile rather than the full .NET Framework.

Mike Taulty’s The .NET Client Profile post of 8/26/2008 and The .NET Client Profile ( 2 ) of 8/27/2008 cast a jaudiced eye on the process of installing .NET 3.5 SP 1 on client computers with ClickOnce. Mike says:

If you're building something like a .NET WPF client application then one of the major bugbears (for both you and for Microsoft - let's be honest here :-)) is trying to get the .NET Framework on to the client machine.

We're trying to make this easier but if you were to look at the recent .NET Framework packages you'd perhaps not be able to tell that :-)

Miscellaneous (WPF, WCF, Silverlight, etc.)

•••• Phil Haack announces ASP.NET MVC CodePlex Preview 5 Released on 8/29/2008 and says the next release will be the official beta version. The post contains links to other important MVC-related articles.

• Roger Jennings reports problems with Internet Explorer 8 Beta 2’s new Web Slices feature in Fail on First Try of Internet Explorer 8 Beta 2 Web Slices of 8/29/2008. •••• Updated

•• Roger Jennings takes Jaiku’s new Google App Engine implementation to task in Jaiku + Google App Engine = Fail of 8/28/2008. The malformed home page shown in the post, which has lost its CSS content, took over a minute to load.

•• Aaron Skonnard posted Endpoint Screencasts - Hosting WCF Services in IIS to Channel 9 on 8/28/2008:

In this short video, CSD MVP Aaron Skonnard from PluralSight guides the viewer through how to host your WCF Service in IIS. We will start with the simple WCF service that we created in the first screencast, hosting it as an ASP.NET svc file. Aaron then demonstrates adding a couple endpoints (for greater detail, see the screencast on creating WCF endpoints) and accessing the service. Once we have our WCF service hosted in ASP.NET, we add it as an application to IIS for consumption.

The IE Team posted IE 8 Beta 2 for download on 8/27/2008. I installed it to try Web Slices on LINQ and Entity Framework Posts for M/D/YYYY+. The first item in this category recounts my lack of success with implementing Web Slices.

John Papa’s Great Fiddler Tip For Localhost Testing post of 9/26/2008 describes Shawn Wildermuth’s solution to getting Fiddler 2 to recognize the Cassini Web server’s localhost:port number: Prefix the port number with a period.

WebSlice Content for Internet Explorer 8 Beta 2

OakLeaf LINQ and Entity Framework Links

Last Updated: 8/31/2008 2:20 PM PDT

  • Entity Framework Additions
  • SQL Server Data Services Additions/Updates
  • ASP.NET Dynamic Data Additions
  • LINQ to SQL Additions
  • LINQ to Objects, XML, etc. Additions
  • Miscellaneous Additions
    • ASP.NET MVC Preview 5 Released to CodePlex
    • Problems with IE8B2's Web Slices Feature

0 comments: