views:

53

answers:

1

I created a new Entity Framework model from a database. This database has a number of tables, the main table is phones_extensions. The phones_extensions table has columns which are FK's to the other tables - e.g. the restriction_class_id is an FK linking to the phones_restictions_class table where the PK is ID.

The EF4 model automatically generates associations for the tables. Great. Now when I run my application I see not only the numeric restriction_class_id but I also see the textual content pulled in by the association (e.g. phones_restriction_class.name).

But what if I don't want to keep all those extra columns? I right click and delete the restriction_class_id but now I get the error mentioned in the subject of this question.

Is there a way for me to remove the columns so I don't have to mess with them in my applicaiton but still have the associations display correctly?

+1  A: 

When you generate your model, un-check the option "Include foreign key columns in the model on the "Choose Your Database Objects" page of the wizard.

Craig Stuntz