Wednesday, February 04, 2009

LINQ and Entity Framework Posts for 1/26/2009+

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

• Updated 1/28/2009 5:00 PM PST: Additions
• Updated 2/4/2009 5:00 PM PST: Substantial additions

Entity Framework and Entity Data Model (EF/EDM)

Julie Lerman alerts readers on 2/2/2009: Dear Rough Cuts Readers: Safari PDF for Programming Entity Framework is still the Rough Cuts version (as of Feb 2).

•• Diego Vega’s EntityDataSource and Bind: What are those square brackets? post of 2/2/2009 explains that:

[T]he design time component of ASP.NET will catch property names that contain dots, and it will try to escape them by surrounding them with square brackets (leading to a Bind expression of the form “[Categories.CategoryID]”).

Unfortunately, the rest of the ASP.NET components which need to evaluate the binding expression are actually not capable of parsing the square brackets escaping notation (i.e. for DataBinder.Eval() the brackets actually indicate that a lookup in an indexed property is necessary, and there is no indexed property in this case).

The workaround is to delete the square brackets.

My Free Huagati DBML/EDMX Professional Tools License for 10 Purchasers of my LINQ and Entity Framework Book post of 1/29/2009 explains how purchasers of my new book can get a free Huagati DBML/EDMX Tools (Professional edition) license.

•• Matthieu Mezil’s EDM can save your hair :-) post of 1/29/2009 explains how to deal in the EDM Designer and CSDL file with a database that has the following characteristics:

  • an asbtract entity type Base (mapped on Bases)
  • an entity type Entity which inherits Base and which is mapped on Inheriteds
  • an entity Description
  • an 1 -> * association between Base and Description

Muhammad Mosa (a.k.a. Moses of Egypt)’s First Steps toward Test Driven Design\Development post of 1/28/2009 describes his efforts to apply TDD with EF and promises to “show how to follow TDD while working with Entity Framework and being independent of it” while implementing the guidelines quoted in this post, which “where like magic words to me. Keep tuned.”

Stefan Cruysberghs’ Sharing source code between .NET and Silverlight post of 1/27/2009 observes:

A common problem when developing Silverlight applications is how to share classes and especially (Entity Framework) entities which are compiled for the full .NET framework in a Silverlight application. Silverlight is a browser plugin and a subset of the full .NET framework. Therefore Visual Studio does not allow referencing .NET assemblies from your Silverlight application.

Fortunately there is a very simple technique to share source code. In this article I will try to demonstrate this technique with several real world examples and I will give you some handy tips.

My “Professional ADO.NET 3.5 with LINQ and the Entity Framework” Is in Stock at Amazon post of 1/23/2009 alerts LINQ and EF aficianados to the availability of my latest book. (Repeated from last week’s post.)

Julie Lerman announces in Entity Framework at Philly.NET followed by a Hands on Lab Tomorrow night (1/27) that Bill Wolff (the user group leader) and Rob Keiser are leading a Entity Framework hands-on-lab on 1/27/2009 from 6:00 - 8:30 PM at Fort Washington, PA. More details are available on Philly.NET's home page.

David Sceppa’s Entity Framework-Enabled Providers Lists post of 1/26/2009 lists released providers here and released and all publicly available providers, including pre-release (beta) providers here.

LINQ to SQL

Andrei Rinea reports and works around a LINQ to SQL NullReferenceException gotcha on 1/30/2009. (The comments are in Romanian.)

Joel Cunningham’s Regenerate Linq to Sql Classes post of 1/28/2008 shows how to “call a replace.vbs script after creating the dbml file” … “to change the DataContext from being public to internal which is not possible to do using sqlmetal.”

LinqMaster describes How to Use Compiled Queries in Linq to Sql for High Demand ASP.NET Websites in his 1/28/2009 post.

Stan Naspinski’s open-source Slick-Ticket Trouble Ticketing/Help Desk System uses LINQ to SQL rather than Entity Framework for the reasons Stan outlines in his Why I decided to stick with Linq-to-SQL over Linq-to-Entities post of 1/17/2009. You can download the Slick-Ticket C# project from CodePlex; it’s licensed under the GNU General Public License version 2 (GPLv2). Here’s the new ticket screen (click for full-size image):

LINQ to Objects, LINQ to XML, et al.

• Barry Dahlberg’s LINQ to NHibernate, IEnumerable<T> vs IQueryable<T> post of 2/1/2009 explains that NHibernate’s session.Linq<Foo>().WithId(123).Single() returns an IQueryable<Foo> which doesn’t touch the database. Barry shows an extension method that returns the desired <Foo> instance.

•• Maarten Balliauw’s PHPLinq 0.4.0 released on CodePlex! describes PHPLinq (a.k.a. LINQ to PHP) and the new features in version 0.4. About PHPLinq, he writes:

PHPLinq is a class library for PHP, based on the idea of Microsoft’s LINQ technology. LINQ is short for language integrated query, a component in the .NET framework which enables you to perform queries on a variety of data sources like arrays, XML, SQL server, ... These queries are defined using a syntax which is very similar to SQL.

Using PHPLinq, the same functionality is created in PHP. Since regular LINQ applies to enumerators, SQL, datasets, XML, ..., I decided PHPLinq should provide the same infrastructure.

Eric White describes an approach and presents code for normalizing LINQ to XML trees in his Equality Semantics of LINQ to XML Trees post of 1/27/2008. Eric writes:

In certain scenarios, it is important to be able to compare two XML trees for equivalence. For example, if you are writing a web service that serves results of queries, and you want to cache query results so that duplicate queries use previously cached results instead of always accessing the underlying database. However, the senders of those queries may potentially be using a variety of tools to generate the queries, and these tools may introduce trivial differences into the XML. The intent of the queries may be identical, but XNode.DeepEquals returns false if you compare the XML that contains semantically equivalent, but trivially different queries.

Mike Taulty takes on Anonymous Methods, Lambdas, Confusion in this 1/28/2009 post. Mike writes:

Not surprisingly, not everyone out there is on .NET Framework V3.5 Service Pack 1 and not everyone is yet writing LINQ queries and using Lambdas and so on and so there’s still a need to try and catch up with some of what’s been going on.

This is going to be particularly true in the VB world where some of the language features are not present until Visual Studio 2010 ships.

I thought I’d try and write a “potted history” of what’s been going on in with all these lambdas and anonymous methods and so on to see if that’s of any help.

Dan Whalin’s Free Webinar – Increase Productivity with .NET and LINQ post of 1/25/2009 announces that Dan will present a 00:50:00 Webinar about LINQ to Objects, LINQ to XML, LINQ to SQL, and LINQ to Entities on February 5, 2009 at 1:00 P.M. EST (10:00 AM PST). According to the abstract:

Interested in increasing developer productivity?  This webinar from ROI Training and The Wahlin Group will introduce .NET developers to Microsoft’s Language Integrated Query (LINQ) technology and show how it can be used to minimize code and application maintenance costs.  The webinar is presented by Dan Wahlin who will introduce several LINQ technologies including LINQ to Objects, LINQ to XML, LINQ to SQL and LINQ to Entities.  Learn to query object collections and XML and see how data from a database can be automatically mapped to custom data entity objects with minimal coding.

ADO.NET Data Services (Astoria)

Sebastien Lambla’s How to Fix Microsoft’s Two-Tier Service Application Scenario (REST) post of 1/25/2009 takes Microsoft’s patterns & practices group to task for their Two-Tier Service Application Scenario (REST) post to CodePlex’s patterns & practices: App Arch Guide 2.0 Knowledge Base. Seb’s introduction states:

I’ve had many rants about Microsoft’s attitude towards REST and the marketing branding they put on (some teams being much worse than others by arrogantly or unknowingly putting the word REST on the name of their framework).

This entry is no such rant, but an effort to outreach to the authors. The document has issues, but it is my belief that with the right corrections, it could be made accurate.

ASP.NET Dynamic Data (DD)

Steve Naughton continues his DD rampage with Making Individual Tables Read Only – Dynamic Data of 1/28/2009.

Steve Naughton’s Disallow Navigation on ForeignKey FieldTemplate – Dynamic Data post of 1/26/2009 is based on his response to the A few problems with my dynamic data website thread in the ASP.NET Dynamic Data forum.

SQL Data Services (SDS) and Cloud Computing

This topic moved on 1/3/2009 to Windows Azure and Cloud Computing Posts.

SQL Server Compact (SSCE) 3.5 and Sync Services

Liam Cavanaugh’s What's New with Sync Framework post of 1/26/2009 describes “what [has been] going on … in the Sync Framework team since last November.” Topics include:

  • Sync Framework v2
  • Sync Services for ADO.NET v2
  • Project “Huron”
  • SyncToy 2.0

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

•• John Papa’s Silverlight, Syndicated Feeds, and Isolated Storage post of 2/1/2009 describes his “Data Points” column entitled “Syndicated Data And Isolated Storage In Silverlight” for the February 2009 issue of MSDN Magazine. The article addresses:

•• J Sawyer, a Microsoft Developer Evangelist in Houston, TX, describes Url Routing in ASP.NET in this 1/30/2009 post.

•• Shawn Wildermuth reports that the New Oslo CTP is Live! but doesn’t include the Quadrant tool. Shawn promises more posts about the new CTP shortly.

•• Mike Amundsen raises issue of developers ignoring the full set of HTTP methods in his ASP.NET MVC: so POST == DELETE, eh? post of 1/30/2009. Mike says “no” to use of POST for RESTful PUT and DELETE operations.

Shawn Wildermuth’s Building AgiliTrain: Part 1 - Why ASP.NET MVC post of 1/28/2009 explains:

I've spent the better part of six weeks building the new AgiliTrain website and its been quite a lot of fun. Of course if you have been reading this blog for long you know that I usually take a personal project like this as an opportunity to learning something new.  In this case I did three things I haven't done on a personal project before:

  • Use ASP.NET MVC (Beta)
  • Use Oslo's MSchema
  • Use a Designer

I've been thinking a lot about how I would characterize my experience with ASP.NET MVC. I recently was at a talk from Paul Lockwood (at the Atlanta .NET User Group) and he thought that it was two weeks of a steep learning curve then bliss.  That's pretty close to my experience.  I thrashed for a couple of weeks wondering whether going back to WebForms would be faster...but I was patient.

•• Guy Burstein reports the availability of ASP.NET MVC 1.0 RC source code in his Just Released: Source Code for ASP.Net MVC 1.0 RC post of 1/28/2009.

Ben Hall test drives the ASP.NET MVC 1.0 RC on 1/27/2009 and writes ASP.net MVC RC1 - ViewData.Model becomes Model and ASP.net MVC RC1 – Removing Code Behind files.

Stefan Cruysberghs’ Sharing source code between .NET and Silverlight post of 1/27/2009 observes:

A common problem when developing Silverlight applications is how to share classes and especially (Entity Framework) entities which are compiled for the full .NET framework in a Silverlight application. Silverlight is a browser plugin and a subset of the full .NET framework. Therefore Visual Studio does not allow referencing .NET assemblies from your Silverlight application.

Fortunately there is a very simple technique to share source code. In this article I will try to demonstrate this technique with several real world examples and I will give you some handy tips.

[Copied from the Entity Framework and Entity Data Model (EF/EDM) section]

Scott Guthrie’s ASP.NET MVC 1.0 Release Candidate Now Available post of 1/27/2009 announces the availability of ASP.NET MVC 1.0 RC1 and describes its new and/or improved features:

  • Visual Studio Tooling Improvements
    • Add Controller Command
    • Add View Command
    • Adding and Customizing Scaffold Templates
    • Go To Controller / Go To View
    • MSBuild Task for Compiling Views
    • View Refactoring Support
  • View Improvements
    • Views without Code-Behind Files
    • Model Property
    • Setting the Title
    • Strongly Typed HTML/AJAX Helpers
  • Form Post Improvements
    • ModelBinder API Improvements
    • IDataErrorInfo Support
  • Unit Testing Improvements
    • ControllerContext changed to no longer derive from RequestContext
    • AccountsController Unit Tests
  • Cross Site Request Forgery (CSRF) Protection
  • File Handling Improvements
    • File Uploading Support
  • AJAX Improvements
  • jQuery Intellisense Files included within ASP.NET MVC Project Template
    • Request.IsAjaxRequest Property
    • JavaScriptResult ActionResult and JavaScript() helper method

5 comments:

Anonymous said...

Did you miss this :

http://blogs.msdn.com/mattwar/archive/2009/01/22/building-a-linq-iqueryable-provider-part-xiii-iqtoolkit-v-0-13.aspx

Mike
Milton Keynes, U.K.

Roger Jennings (--rj) said...

@Mike,

Nope, didn't miss it.

It's in LINQ and Entity Framework Posts for 1/19/2009+ (http://oakleafblog.blogspot.com/2009/01/linq-and-entity-framework-posts-for_21.html)

--rj

Anonymous said...

I have translated the comments from Romanian to English so any visitor can read them easily. :)

Roger Jennings (--rj) said...

@Andreir,

Thanks for the translations.

--rj

Anonymous said...

It is my pleasure :)