为什么Database First EF跳过映射一些表? [英] Why does Database First EF skip mapping some tables?

查看:170
本文介绍了为什么Database First EF跳过映射一些表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Entity Framework 4和数据库优先绑定,而EF不会为我的几个表生成实体。我没有得到任何错误,无论从设计表面上的从数据库更新模型弹出菜单中选择要生成的表,我们仍然缺少相同的表。

I'm using Entity Framework 4 and with a Database First binding, and EF is not generating the entities for a few of my tables. I'm not getting any errors, and no matter how many times I select the tables to generate from the "Update Model from Database" popup menu on the design surface, the same tables are still missing from the model.

在向导中没有错误。他们只是不生成。任何线索?

I get no errors in the wizard. They just don't get generated. Any clues?

推荐答案

EF需要表上的主键。 EF不会映射找不到或派生主键的表。如果所有列都为空,则不能使用主键。如果一个或多个列不可为空,则EF将明显地导出该表的主键。

EF requires a primary key on the table. EF will not map tables for which it can't find or derive a primary key. If all columns are nullable, it can't assume a primary key. If one or more columns are not nullable, EF will evidently derive a primary key for the table.

这篇关于为什么Database First EF跳过映射一些表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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