Navigating by foreign keys in ADO.NET Entity Framework/MySQL
Posted
by Werg38
on Stack Overflow
See other posts from Stack Overflow
or by Werg38
Published on 2010-04-22T20:42:18Z
Indexed on
2010/04/25
21:13 UTC
Read the original article
Hit count: 206
I am using ASP.NET MVC2 on top of a MySQL database in VS2008. I am using the MySQL ADO.NET connector 6.2.3 to provide the connection for the ADO.NET Entity Data Model.
This is mostly working ok, however navigating via foreign keys is causing me a real headache!
Here is a simplified example..
Car (Table)
CarID PK
Colour
Doors
ManufacturerID FK
Manufacturer (Table)
ManufacturerID PK
Name
In the edmx file I can see the 1-many relationship shown as a navigation property in the both the Car and Manufacturer tables. I create a Models.CarRepository that allows me to returns a IQueryable.
At the View I want to be able to display the Manufacturer.Name for each car. This is not accessible via the object I get returned.
What is best way to implement this? Have I encountered a limitation of the Entity Framework/MySQL combination?
© Stack Overflow or respective owner