Update 8/18/2008: Scott Hunter of the DD Team posted to the Dynamic Data Entity Framework Workaround thread 0f 8/16/2008 a message with a link to the workaround in CodePlex for the "A property with name 'XX.Id' does not exist in metadata for entity type 'XX.XX.XXXX'” exception with the Entity Framework as a data source.
For more information about the workaround, see Workaround for Dynamic Data Entity Framework Posted post of 8/16/2008.
Apparently the DD team tested their SP1 release only with LINQ to SQL as the data source. This is surprising when you consider the emphasis the Data Programmability group is placing on Entity Framework.
I’ve tested Microsoft.Web.DynamicData.dll (the replacement for System.Web.DynamicData.dll) and the revised RegisterContext() method. It fixes the problem for me. The updated version of the DynamicDataWebApp project has been incorporated in a replacement for the VS0808RJ.zip file that should be posted at http://code.visualstudiomagazine.com/vs0808rj.zip shortly. The DynamicDataWebSite file-system project uses LINQ to SQL as its data source, so it wasn’t affected by the DD team’s gaffe.
In the meantime, you can download the updated code from SkyDrive.
Original Content Starts Here
A reader of my “Generate Web Sites Automatically” cover story for the August 2008 issue of Visual Studio Magazine reported today that the accompanying sample code threw a runtime exception under VS 2008 SP1 when clicking the View Order_Details link of the Orders list page shown below (click image for a full-size capture):
The “A property with the name ‘Order.OrderID’ does not exist in metadata for entity type ‘NorthwindModel.Order_Detail’” runtime error appears as follows (click for full size):
This problem was reported on August 13, 2008 in Dynamic Data SP1 chokes on Northwind and AdventureWorks using ADO.Net Entity Data Model thread or the ASP.NET ASP.NET Dynamic Data forum. According to David Ebbo’s reply on the same date:
There is indeed an issue with the Entity Data Source that is causing this. Here it is described by someone from the Entities team:
"Currently for a (1 : 0..1) relationship, we expose references to the “1” end but we don’t expose the references to the “0..1” end. For ex: consider something like “Person”->”PersonDetails” with a (1 : 0..1) relationship between them:
There will be a property descriptor “Person” on “PersonDetails” entity. However there’ll be no property descriptor called “PersonDetails” on “Person” entity."
We'll see if there are some possible workarounds. BTW, you mention that you also see this with Northwind. Specifically, which Northwind table are you seeing this on?
It appears to me that the problem differs from the description above. The multiplicity of the Order:Order_Details relationship is 1:*, and there is no reason for an attempt to read the Order_Details.Order.OrderID value from the associated (1:0..1) EntityReference.
If there aren’t “some possible workarounds” available immediately, this will be a serious blow to the Data Programmability group’s attempt to position the Entity Framework as the preferred data source for new programming frameworks, such as ADO.NET Data Services (Astoria).
In the event there’s no prospect for a timely workaround, I’ll change the data source for the sample projects from Entity Framework to LINQ to SQL and update the sample code accordingly.