Entity Framework Core导航属性加载问题
前言
今天下午在开发的时候发现EF Core实体模型中的导航属性为 null,经排查既不是没有加 virtual 关键字,也不是外键关系映射错误。

解决方法
通过查询官网文档,发现,原因在于EF Core目前不支持延迟加载,所以每次查询,都会得到 null 的导航属性。目前只有使用 预先加载 或 显示加载 才能得到正确的导航属性。
最后我使用显示加载成功得到导航属性的数据,具体使用方法可进官网文档查看。

Entity Framework Core导航属性加载问题的更多相关文章
- Entity Framework Core 导航属性 加载数据
Loading Related Data https://docs.microsoft.com/en-us/ef/core/querying/related-data Eager loading me ...
- 浅谈Entity Framework中的数据加载方式
如果你还没有接触过或者根本不了解什么是Entity Framework,那么请看这里http://www.entityframeworktutorial.net/EntityFramework-Arc ...
- Entity Framework 4.1 : 贪婪加载和延迟加载
这篇文章将讨论查询结果的加载控制. EF4.1 允许控制对象之间的关系,当我们进行查询的时候,哪些关系的数据将会被加载到内存呢?所有相关的对象都需要吗?在一些场合可能有意义,例如,当查询的实体仅仅拥有 ...
- 关闭Entity Framework的导航属性
public RIS30Entities() : base("name=RIS30Entities") { this.Configuration.ProxyCreationEnab ...
- Entity Framework Core 1.1 Preview 1 简介
实体框架核心(EF Core)是Entity Framework的一个轻量级,可扩展和跨平台版本. 10月25日,Entity Framework Core 1.1 Preview 1发布了. 升级到 ...
- Working with Data » Getting started with ASP.NET Core and Entity Framework Core using Visual Studio » 读取关系数据
Reading related data¶ 9 of 9 people found this helpful The Contoso University sample web application ...
- Entity Framework Core 1.1 升级通告
原文地址:https://blogs.msdn.microsoft.com/dotnet/2016/11/16/announcing-entity-framework-core-1-1/ 翻译:杨晓东 ...
- Working with Data » Getting started with ASP.NET Core and Entity Framework Core using Visual Studio » 更新关系数据
Updating related data¶ 7 of 7 people found this helpful The Contoso University sample web applicatio ...
- Working with Data » Getting started with ASP.NET Core and Entity Framework Core using Visual Studio » 创建复杂数据模型
Creating a complex data model 创建复杂数据模型 8 of 9 people found this helpful The Contoso University sampl ...
随机推荐
- Knowing is not enough; we must apply. Willing is not enough; we must do.
Knowing is not enough; we must apply. Willing is not enough; we must do. 仅限于知道是不够的,我们必须去实践:单纯的希望是不够的 ...
- 使用Groovy+Spock构建可配置的订单搜索接口测试用例集
概述 测试是软件成功上线的安全网.基本的测试包含单元测试.接口测试.在 "使用Groovy+Spock轻松写出更简洁的单测" 一文中已经讨论了使用GroovySpock编写简洁的单 ...
- Linux服务器---流量监控MRTG
MRTG MRTG可以分析网络流量,但是它必须依赖SNMP协议.将收集到的数据生成HTML文件,以图片的形式展示出来 1.安装一些依赖软件 [root@localhost bandwidthd-2.0 ...
- 2017年3月29日 webService入门理解 二
前边说到了N多webService的概念. 其实,说白了,我个人理解的话,webService就是一个“概念”.就好像互联网一样,就是一个很虚幻,很高的一个概念.同样,webService也是.互联网 ...
- JavaScript:原生JS实现Facebook实时消息抓捕
基础知识准备: HTML5给我们提供了一个新的对象叫作:MutationObserver.为了兼容,还有WebKitMutationObserver.MozMutationObserver,挂靠在wi ...
- js/jquery对特殊字符进行转义防止js注入使用示例
/** JQuery Html Encoding.Decoding * 原理是利用JQuery自带的html()和text()函数可以转义Html字符 * 虚拟一个Div通过赋值和取值来得到想要的 ...
- MaxiSYS Elite
The Maxisys Elite is Autel UK’s top of the range diagnostic and analysis scanner with advanced J2534 ...
- 使用WebClient下载网页,用正则匹配需要的内容
WebClient是一个操作网页的类 webClient web=new WebClient(): web.DownloadString(网页的路径,可以是本地路径);--采用的本机默认的编码格式 ...
- Git 常用命令列表
1 常用 $ git remote add origin git@github.com:yeszao/dofiler.git # 配置远程git版本库 $ git pull origin master ...
- 一文看懂显示关键材料之彩色滤光片(Color Filter)
http://www.sohu.com/a/219398623_119960 液晶显示器的背光源发出的白光,而想要获得彩色显示,必须依靠显示关键材料-彩色滤光片. 图片来源:网络公开资料 什么是彩色滤 ...