Sunday, October 19, 2008

LINQ and Entity Framework Posts for 10/13/2008+

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

Update 10/18/2008 5:30 PM PDT: Minor additions
• Update 10/16/2008 4:30 PM PDT: ASP.NET MVC Beta and other additions
• Update 10/14/2008 5:00 PM PDT: Minor additions

Entity Framework and Entity Data Model (EF/EDM)

Matthieu Mezil’s ADO.NET Data Services Hooking POC V3 post of 10/17/2008 continues his Proof of Concept series about using EF as a data source for ADO.NET Data Services.

He finishes implementing the IUpdatable interface and enables the System.Collections.ObjectModel.Collection’s Count property in ADO.NET Data Services Hooking POC V3 .1 of 10/18/2008.

Note: The current v3.1 CodePlex download appears to be a T-SQL script, not source code for an IUpdatable implementation.

Ezequiel Sculli’s How-To: Perform Update Actions using an ObjectContainerDataSource with Entity Framework post of 10/16/2008 describes how to work around the failure of EF to update the data store with changes and display them in the postback. The workaround, according to patterns & practices’s How-To: Perform Update Actions using an Object Container Data Source with Entity Framework is to create a new instance of the entities for each operation performed.

Note: The ObjectContainerDataSource is a component of the Web Client Software Factory (WCSF).

•• The EF Team posted Migrating from LINQ to SQL to Entity Framework: Deferred Loading, the second in its EF from LINQ to SQL migration series, on 10/16/2008.

When the team finishes the series, will we receive the official deprecation notice for LINQ to SQL? See my Is the ADO.NET Team Abandoning LINQ to SQL? post of May 23, 2008.

Beth Massi’s Editing Data from Two Tables in a Single DataGridView post of 10/15/2008 explains how to update data from two tables in a DataGridView by entity splitting with the Entity Framework, LINQ to SQL, and DataSets as data sources.

Kristofer Andersson updated the Huagati DBML/EDMX Tools to version 1.40 on 10/15/2008. For more information, see the entry in the LINQ to SQL section.

David Sceppa announced on 10/14/2008 that Npgsql's ADO.NET Provider for PostgreSQL Supports the ADO.NET Entity Framework! For more details, see the PGFoundry blog’s Release Notes for Npgsql2.0RTM

Matthieu Mezil’s Bug with IQueryable and yield syntax: System.BadImageFormatException "An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)" post of 10/14/2008 describes an exception that occurs when attempting to execute the yield return statement on an IQueryable<T> sequence.


Beth Massi’s Editing Data from Two Tables in a Single DataGridView post of 10/15/2008 explains how to update data from two tables in a DataGridView by entity splitting with the Entity Framework, LINQ to SQL, and DataSets as data sources. (Repeated from EF/EDM.)

Kristofer Andersson updated the Huagati DBML/EDMX Tools to version 1.40 on 10/15/2008. According to Kris, the updates include:

  • Added [HuagatiDBMLTools.msi] installer / uninstaller
  • Improved performance of the "Update Documentation" feature for LINQ to SQL
  • Moved menu items to a separate dropdown menu ("DBML/EDMX Tools") on the VS2008 menu bar to avoid congestion in the standard Tools menu
  • Fixed issue where the mouse pointer sometimes showed the hourglass/wait pointer when dialogs were visible
  • A couple of minor adjustments to the pluralization/singularization rules
  • Better handling of some reserved SQL keywords

Save the .zip file to a temporary folder, extract the files with the Use Folder Names option selected, and then run HuagatiDBMLTools.msi to install the files in a \Program Files\…\HuagatiExtensions folder. The installer adds a Huagati DBML EDMX Tools node to your Programs menu with Reset Add-in Menus in VS 2008 and User Guide commands. If you’ve installed an earlier version, choose Reset Add-in Menus in VS 2008 after installation.

Sidar Ok writes his own POCO classes and basic unit tests, and then uses SqlMetal’s XML mapping file option to generate the mapping layer in his Achieving POCO s in Linq to SQL post of 10/14/2008. Be sure to read the comments.

Rob Conery’s Make Visual Studio Generate Your Repository post of 10/13/2008 shows you how to use VS 2008 Text Template Transformation Toolkit (T4) feature to wrap a LINQ to SQL with a testable IQueryable Repository framework for use with (what else than) MVC.

Rob includes links to the Clarius's T4 template editor and Damien Guard’s LINQ to SQL templates. For additional details on Damien’s templates, see my Bidirectional Serialization of LINQ to SQL Object Graphs with Damien Guard’s T4 Template in VS 2008 SP1 post of 9/25/2008. (See Scott Hanselman’s T4 post in the Misc. category.)

Neil Pullinger recommends that you Always set AutoPage to true in LinqDataSource in his 10/14/2008 post. If AutoPage is false, your page retrieves all rows from the data source.

LINQ to Objects, LINQ to XML, et al.

•• Corey Roth’s My 500th Post! Left Outer Joins with LINQ post of 10/16/2008 is his 500th - Tip of the Day item. The series began on 12/1/2004.

•• Eric Meijer and Bart De Smet conduct the centennial edition of Channel9’s Going Deep series: Erik Meijer and Bart De Smet: LINQ-to-Anything of 10/15/2008. Here’s an excerpt from the deck:

Meet Bart de Smet, a software engineer extraordinaire on the WPF team who spends his free time blogging (what an incredible wealth of truly useful technical information to be found on Bart's blog!) and creating custom LINQ providers. In fact, Bart is probably the world's most prolific LINQ provider creator, from LINQ-to-MSI to LINQ-to-Simpsons! How does he do it???

Who better to have involved in this LINQ'ified conversation (with lots of whiteboarding) than LINQ co-creator, programming languages designer, fundamentalist functional programming high priest and Channel 9 star Erik Meijer?

•• Steven Taub and Hazim Shafi contributed the “Improved Support For Parallelism In The Next Version Of Visual Studio” article to the “Coding Tools” column for MSDN Magazine’s October 2008 issue. VS 2010 will include a new viewer that offers MultiStack and Task views of parallel processes to simplify debugging:

MultiStack View (screen capture courtesy of Microsoft)

Task View (screen capture courtesy of Microsoft)

The article also describes forthcoming Concurrency, Thread Blocking, and Core Execution and Thread Migration views to analyze performance issues and aid debugging.

Steven Taub announces that .NET 4.0’s System.core.dll will include PLINQ and mscorlib.dll will contain the Parallel Extensions (ParallelFx) in his Parallel Programming and the .NET Framework 4.0 post of 10/10/2008. His Parallelism in October 2008 MSDN Magazine post of 10/2/2008 has links to articles about parallelism in MSDN Magazine’s October 2008 issue.

Kevin Hoffman’s Implementing the Weak Event Pattern in CLINQ v2.0 of 10/13/2008 describes why CLINQ requires the Weak Event Pattern (weak delegates) to avoid inadvertent memory leaks.

ADO.NET Data Services (Astoria)

Matthieu Mezil’s ADO.NET Data Services Hooking POC V3 post of 10/17/2008 continues  his Proof of Concept series about using EF as a data source for ADO.NET Data Services.

He finishes implementing the IUpdatable interface and enables the System.Collections.ObjectModel.Collection’s Count property in ADO.NET Data Services Hooking POC V3 .1 of 10/18/2008. (Repeated from the EF category.)

Note: The current v3.1 CodePlex download appears to be a T-SQL script, not source code for an IUpdatable implementation.

Phani Raju of the Astoria team discusses the reason for the use of the Astoria client’s DataServiceContext.SetLink() method for change tracking associated objects in his Viewer Mail , #1 post of 10/15/2008.

For additional background on updating associated objects with the Astoria client library, see Phani’s Working with Associations in ADO.NET Data Services post of 7/2/2008.

Tim Heuer’s Silverlight 2 Released: New controls, tools, announcements! post of 10/14/2008 says the following about support for Astoria in the RTM version:

If you have an ADO.NET Data Services (the artist formerly known as Astoria) endpoint, in your Silverlight 2 project you can choose Add Service Reference and point to that endpoint and the appropriate proxies will be generated for you.

Tim’s Silverlight and ADO.NET Data Service proxy generation post of later the same day provides more details on the use of Add Service Reference for Astoria services. (Don’t forget that the service must be running for the Add Service Reference dialog to find it.)

Shawn Wildermuth’s ADO.NET Data Services and TimeZone points out a problem with URL-encoding positive ISO 8601 time zone offsets, such as +3:00 for Bulgaria. URL encoding replaces the + with a space, which leads to an incorrect result. Applying the ToUniversalTime() method is a solution, but Shawn says “that’s a hack at best.”

ASP.NET Dynamic Data (DD)

••• Scott Hanselman unleashed a tsunami of Hanselminutes podcasts on 10/28/2008. Two of these are related to MVC, DD, and scaffolding:

•• Scott Hanselman’s ASP.NET MVC Beta released - Coolness Ensues post of 10/16/2009 (3:37 PM PDT) announces that the beta has a Go-Live license, includes jQuery, and offers a set of links into ScottGu’s “new feature” topics described in the Misc. section. ScottHa says:

I also showed [at VS Live! 2008 Las Vegas] ASP.NET+Dynamic Data that you'll be hearing more about at PDC and even more next year. You should feel free to use these subsystems as you like, mix and match, promote and ignore. Whatever makes you happy. All the ASP.NET core stuff like Authentication, Authorization, Session, Caching, etc, that all works in all of these subsystems because they are all ASP.NET.

SQL Server Data Services (SSDS) and Cloud Computing

••• Dare Obasanjo analyzes Tim Bray’s issue with vendor lock-in with cloud computing in his aptly named Cloud Computing and Vendor Lock-In post of October 19, 2008. Dare concludes:

[T]he fact is that today if a customer has heavily invested in either [the Amazon EC2/S3 or Google App Engine] platform then there isn't a straightforward way for customers to extricate themselves from the platform and switch to another vendor. In addition there is not a competitive marketplace of vendors providing standard/interoperable platforms as there are with email hosting or Web hosting providers.

As long as these conditions remain the same, it may be that lock-in is too strong a word describe the situation but it is clear that the options facing adopters of cloud computing platforms aren't great when it comes to vendor choice.

Of course the lock-in problem also applies to SSDS. If you’re willing to lock yourself into Windows Server 2008 and SQL Server 200x, Microsoft and Amazon might be interchangeable cloud hosting vendors. 

••• John Foley announces Information Week’s new “Cloud Computing Destination” in his InformationWeek Launches post of 10/17/2008. John says:

Our research tells us that business technologists are intrigued by cloud computing, but not yet swayed. InformationWeek Analytics (our in-depth reports business) surveyed 456 business technology professionals to gauge their plans for cloud computing. Among the respondents, 20% were considering cloud services, while another 28% said they didn't know enough about them. In other words, nearly half are still mulling it over. Of the rest, 18% said they were already using cloud services and 34% had no interest.

If 18% of respondents are using cloud services and 20% are considering using them, I’d say that 38% is more than intrigued with a new and controversial technology.

••• Pete Kooman of the Google App Engine team says in his Announcing HTTPS support for! post of 10/16/2008 that GAE will finally support secure HTTP communication, but only with URLs. There will be no HTTPS support for arbitrary Google Apps domains.

Gartner Inc assigns the #2 Strategic Technology for 2009 to Cloud Computing in their Gartner Identifies the Top 10 Strategic Technologies for 2009 post of 10/16/2008. (Virtualization is #1).

• Eugenio Pace and Gianpaolo Carraro wrote a “Head in the Cloud, Feet on the Ground” post for Microsoft Architecture Journal, issue #17, which was posted online on 10/15/2008.

Gianpaolo excerpts liberally from the article in his Head in the cloud, Feet on the ground: an article about the cloud post of the same date to support the article’s transportation analogy to computing services, which is the underlying theme of the pair’s Cloud Services Architecture Symposium to be held on day 4 of PDC 2008.

Ken Oestreich’s Postcards from the Cloud Summit Executive Conference post of 10/14/2008 provides a detailed rundown of the Cloud Summit Executive conference held at the Computer History Museum in San Jose on the same date.

Eric Eldon announces the arrival of Cloudera, a startup specializing in helping organizations adopt the open-source Hadoop software platform in his Ex-Google, Yahoo, Facebook employees snub recession, launch Hadoop startup post of 10/14/2008. According to the post:

Cloudera will help other companies “install, configure and run” Hadoop [and MapReduce], either on a company’s own servers or using Amazon’s hosted Elastic Compute Cloud (EC2) service.

For more details, see Amr Awadallah’s The Startup is Cloudera, the Business is Hadoop MapReduce post of 10/13/2008, which has links to founders and initial employees’ blogs. Tony Bain explains the differences between Hadoop and RDBMSs in his What is Hadoop? post of October 15, 2008.

Hadoop and MapReduce are likely to be the primary competition to SQL Server Data Services (SSDS) for data sources that are extremely large (petabytes), non-structured, or both. Yahoo! and Facebook run Hadoop.

Mike Amundsen’s Strongly-typed DataSets for SSDS Demo post of 10/14/2008 to the SQL Server Data Services (SSDS) - Getting Started forum describes how to populate DataSets with SSDS entities.

However, C.C.Chai notes in a reply:

Basically, [the] Typed Data Set approach works. Its major disadvantage is preloading large amount of data in order to enable joining, grouping, etc.

When the application requires Customer Entities, I will have to load all the customers first before doing sorting / filtering. Otherwise, I could get wrong results.

The matter is even worse if you try to enforce relationship constraints in the data set. When populating a data table, you have to look for parent tables and fill those first. In my testing, I almost load all the records in my SSDS container because of the complex relationships

SQL Server Compact (SSCE) 3.5 and Sync Services

••• Steve Lasker’s Evolution or Revolution for moving to offline architectures post of 10/17/2008 is a lengthy analysis of the benefits and pitfalls of occasionally-connected systems. Steve makes reference to his earlier Sync Services forADO.NET and SQL Server Compact Presentation (8/21/2007) and his two Tech*Ed US Developers 2007 presentations plus a more recent article:

Mary Jo Foley reports in her Microsoft’s online/offline sync platform (re)released to manufacturing post of 10/17/2008 that the Sync Services team stealth-posted an updated version (RTM1) of the Microsoft Sync Framework v1.0 on 10/13/2008.

To date, there’s been no comment on the updated version in the Microsoft Sync Framework blog nor related messages in any of the five Microsoft Sync Framework forums, which is very strange. Did the original version have bugs?

Miscellaneous (WPF, WCF, MVC, Silverlight, etc.)

Phil Haack’s ASP.NET MVC Beta Released! post of 10/16/2008 reiterates Scott Hanselman’s post on the same topic (see the Dynamic Data section) and notes:

As I warned before, we no longer bundle the Mvc Futures assembly (Microsoft.Web.Mvc.dll). However, we did just publish a release of this assembly updated for Beta on CodePlex. Source code for the Beta and Futures releases will be pushed to CodePlex shortly. Sorry about the delay but there’s so much work to be done here.

•• Scott Guthrie dropped the other shoe by finally posting ASP.NET MVC Beta Released at 12:30 PM PDT on 10/16/2008. His very detailed “post contains a quick summary of some of the new features and changes in this build compared to the previous ‘Preview 5’ release.

He’s “also planning to publish a few end to end tutorials in the weeks ahead that explain ASP.NET MVC concepts in more depth for folks who have not looked at it before, and who want a ‘from the beginning’ set of tutorials on how to get started.”

Robert Shelton, a Microsoft Software Development and Platform Evangelist in the Washington DC area, announced the availability of the official ASP.NET MVC Beta download in his Free download: Microsoft ASP.NET MVC Beta post of 10/15/2008.

I would have expected to see a blog post from Scott Guthrie, Scott Hanselman, or Phil Haack announcing a beta of this significance. According to Redmond Media Group editor Becky Nagle’s “Microsoft Posts ASP.NET MVC Beta for Download” article, Hanselman discussed the beta in his VS Live! 2008 Las Vegas keynote and Guthrie will make the official announcement on 10/16/2008. Regarding the keynote, Becky says:

He also showed off some of the dynamic data capabilities of MVC, including some future capabilities scheduled to be released next summer.

Scott Hanselman seconds Rob Conery’s review of the Text Template Transformation Toolkit (T4) for VS 2008 with an extensive list of links to T4 resources in his T4 (Text Template Transformation Toolkit) Code Generation - Best Kept Visual Studio Secret post of 10/14/2008.

Tim Heuer’s Silverlight 2 Released: New controls, tools, announcements! post of 10/14/2008 provides a detailed description of the new features and controls in the RTW version. Tim notes that the Silverlight Tools RC1 work with the released bits.

Rick Strahl’s detailed Client Templating with jQuery post of 10/13/2008 describes several methods for templating controls, such as displaying rich lists and updating data sources. 

Shawn Wildermuth outlines the changes between Silverlight 2 Beta 2 and the RTM version in his Silverlight 2 Released! post of 10/13/2008.

John Papa offers an abbreviated transcript of Microsoft’s conference call that announced the availability of Silverlight 2.0 RTM in his ScottGu Announces Silverlight 2 Due Out Tomorrow post of 10/13/2008. He also summarizes highlights of the related press release.

Shawn Wildermuth’s Dirty Little Secrets - Episode 2 describes how to “use control templates to skin a complex control in Silverlight 2.”