This project is read-only.

Different MVC versions

Jun 13, 2012 at 10:50 PM

Hi, I'am using MVC3 and VS2010, I've got a problem, when I use Entity framework for creating DB tables using code first strategy.

the auto generated  tables are 3 different tables and one of those is Address, for keeping the connection between Restaurant table and Address there is a filed called Address_Id in Restaurant Table, I've checked it and there is no error,

in the view which is for showing the restaurants info I wrote something like this in Iteration 


but the error says "object reference not set to an instance of an object"

I looked at this project and I saw that for Restaurant table there are all the fields of address added instead of creating another table called Address. So what is the solution? what should I do for retrieving Address info.

Jun 14, 2012 at 3:55 PM

Ok,, I found that my Address entity in some how is different, I've add a field named ID, and when I remove that field, the structure of the DB changed, I mean the Address Table is disappeared and its fields are merged to Restaurants table. could somebody explain what happen?