开发者

MVC Entity Model not showing my table

开发者 https://www.devze.com 2022-12-11 20:59 出处:网络
I have a database with multiple tables, and some basic relationships.Here is an example of the problem I am having:

I have a database with multiple tables, and some basic relationships. Here is an example of the problem I am having:

My Database:

**Org**
ID
Name
etc

**Detail1**
ID
D1name

**Org_Detail1**
Org_ID
Detail1_ID

**Detail2**
ID
D2Name

**Org_Detail2**
Org_ID
Detial1_ID
BooleanField

My problem is, the Org_detail1 table is not showing up in the entity model, but the Org_Details2 table does.

I thought it may have been because the Org_Detail1 table only contains two ID fields that are both primary keys, while the Org_Details2 table contains 2 primary key ID fields as well as a boolean field.

If I add a dummy field to Org_detail1 and update it, it still won't show up and wont allow me to add a new entity relating to the Org_Detail1 table. T开发者_C百科he table won't even show up in the list, but it is listed under the tables.

Is there any solution to get this table to appear in my model?


Seems like I may just need to completely delete the model and recreate it. Adding dummy fields is the only solution I've found.


Not sure this is an MVC problem.

Does a Detail1 collection turn up in your Org entity and an Org collection show up in your Detail1 entity. This is the normal behaviour for Entity framework for a many to many intersecting table with no other tangible data.

If not then maybe the foreign key constraints are not defined.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号