没有名称为'restriction_class_id'的属性,由Role'phones_extensions'引用的类型定义 [英] There is no property with name 'restriction_class_id' defined in type referred by Role 'phones_extensions'
问题描述
EF4模型会自动生成表的关联。大。现在,当我运行我的应用程序时,我不仅看到数字restrict_class_id,而且我还看到关联引入的文本内容(例如,phones_restriction_class.name)。
但是,如果我不想保留所有这些额外的列?我右键点击并删除restriction_class_id,但现在我收到了这个问题主题中提到的错误。
有没有办法删除列,所以我不
当您生成模型时,选中向导中的选择数据库对象页面上的模型中包含外键列的选项。
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?
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.
这篇关于没有名称为'restriction_class_id'的属性,由Role'phones_extensions'引用的类型定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!