实体框架 - 我的导航属性在哪里? [英] Entity Framework - Where are my Navigation Properties?

查看:88
本文介绍了实体框架 - 我的导航属性在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从Northwind生成ADO.NET实体数据模型时,我得到了具有标量和导航属性的结构良好的数据模型,但是当我从我自己的数据库生成时,我只得到标量属性,没有导航属性。

When I am generating ADO.NET Entity Data Model from Northwind I am getting well-structured Data Models with both scalar and navigation properties, but when I am generating from my own Database, I get only scalar properties and no navigation properties.

为什么?

如何获取我自己的数据库表的导航属性?

and how can I get those navigation properties for my own database Tables?

推荐答案

您的数据库不是以添加/更新向导可以识别的方式进行结构化。例如,不使用外键会导致此行为。

Your DB is not structured in a way that the Add/Update wizard can recognize. Not using foreign keys, for example, would cause this behavior.

如果这不是问题,您无法弄清楚向导无法识别您的密钥的原因发布两个相关表的DDL,以及您可能在它们之间定义的任何限制,我会尝试和帮助。

If this is not the problem and you can't figure out why the wizard doesn't recognize your keys, post the DDL for two related tables and any constraints you may have defined between them and I'll try and help.

这篇关于实体框架 - 我的导航属性在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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