没有名称为'restriction_class_id'的属性,由Role'phones_extensions'引用的类型定义 [英] There is no property with name 'restriction_class_id' defined in type referred by Role 'phones_extensions'

查看:89
本文介绍了没有名称为'restriction_class_id'的属性,由Role'phones_extensions'引用的类型定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从数据库创建了一个新的实体框架模型。这个数据库有很多表,主表是phone_extensions。 phones_extensions表具有与其他表格的FK对应的列。 restriction_class_id是一个链接到电话号码为____的表格的FK。



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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆