实体框架中的导航属性是什么 [英] What are the Navigation Properties in Entity Framework

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

问题描述

我是实体框架的新手。当Visual Studio创建模型图时,我们可以在实体中主要看到两件事:属性和导航属性,那么这些导航属性是什么?

I am new to Entity Framework. When the Visual Studio creates Model diagram we can see mainly two things in Entities.Propertie and Navigation Properties,So what are these Navigation Properties? How to use them?

推荐答案

导航属性表示与主体相关的实体。外键通常由导航属性表示。

Navigation properties represents related entites to the principal entity. Foreign Keys are usually represented by navigation properties.

例如:如果您有两个表发票和发票项目,并且这些表之间的关系为1->很多,那么您会发现发票实体中的导航属性,其中列出了与发票有关的所有发票项目。

希望对您有所帮助。

Ex : if you have two tables Invoice and invoice items and those tables have a relation 1-> many so you'll find a navigation property in invoice entity that lists all invoice items related to an invoice.
Hope it helps.

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

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