locked
Problem with class generation from database RRS feed

  • Question

  • I have been following a couple of examples on the entity framework from MSDN. I generated the data model from the AdventureWorks database as instructed in several of the tutorials using the wizard. The problem is with the SalesOrderDetail table and corresponding class. Even though the table has a ProductID column, such a property is not getting created in the corresponding SalesOrderDetail class that gets generated in the AdventureWorks.edmx. Is there anything I could be doing wrong?
    Wednesday, July 1, 2009 5:19 PM

Answers

  • In this release of the Entity Framework, foreign key properties never appear as regular properties on entities--instead you will have a CLR reference and an EntityReference<T> property on the SalesOrderDetail class which will allow you to get the Product object which corresponds to that ID.

    - Danny

    P.S. In EF4 we're adding the ability to have relationships where you will have both the CLR reference and a foreign key property, but this didn't make beta 1--it will be in the next public release of EF4.
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Thursday, July 2, 2009 4:17 AM