Jan 17, 2011 at 1:04 AM
Edited Jan 17, 2011 at 1:34 PM
I got a question about foreign key when "importing" the db into visual studio.
my development environment:
Visual Studio 2008 ASP.NET MVC 2 with .Net framework 3.5 SP1
was following the MVC music store V1.0
in the tutorial pdf, page 50, it says when we creating the "Entity Data Model" at the last stage, we should select "Include foreign key columns in the model.
however, i am using VS2008 and when at this stage there is no such foreign key option to choose.
but i still clicked finish and got the ER diagram like this
plz notice that inside the red circle, it should contain (AlbumId, GenreId, ArtistId, Title, Price, AlbumArtURL)
but my model is missing GenreId and ArtistId.
how do you deal with it?
I encountered a problem later when the i creating edit form and need to use something like [[[[<%= Html.LabelFor(model => model.GenreId) %>]]]]] it is not working.
so i need the GenreId and ArtistId to appear in the Album. i guess it is about the foreign key problem...
do you know how to solve it?
Thanks a lot!!!