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 ...
随机推荐
- Spring源码阅读(三)
上一讲我们谈到单例生产关键方法getSingleton.getSingleton方法由DefaultSingletonBeanRegistry类实现.我们的抽象工厂AbstractBeanFactor ...
- tar命令打包文件夹下所有的文件
例如在/home/rip123/www 路径有aa.txt aab.txt bb.txt cc.txt 文件,想将所有的打包却不想一个个敲: 做法:在www文件夹下输入命令: tar ...
- numpy数学数据处理
数学和统计方法 sum 对数组中全部或某轴向的元素求和.零长度的数组的sum为0. mean 算术平均数.零长度的数组的mean为NaN. import numpy as np import nump ...
- 初探AngularJs框架(二)
一.创建Components组件 直接使用AngularCLI即可很方便的创建component组件,使用如下指令: ng g component components/news 这样就会在compo ...
- hud1007 Quoit Design
#include<algorithm> #include<iostream> #include<cstdlib> #include<cstring> # ...
- TensorFlow 分布式实践
此wiki主要介绍分布式环境使用的一些条件,一直所要注意的内容: 确保在此之前阅读过TensorFlow for distributed 1.集群描述 当前tensorflow 的版本(0.8.0), ...
- 跨域的根本原因:JavaScript 的同源策略
摘自:https://blog.csdn.net/liubo2012/article/details/43148705 同源策略限制了一个源(origin)中加载文本或脚本与来自其它源(origin) ...
- Maven配置阿里云镜像仓库
配置文件:D:\MyDev\Maven\apache-maven-3.0.5\conf\settings.xml <mirrors> <mirror> <id>al ...
- oracle 11g enq: JI – contention等待事件
最近使用物化视图同步的环境在大量刷新的时候频繁出现enq: JI – contention等待事件,经查: JI enqueue is acquired in exclusive mode on th ...
- 【题解】Luogu P4450 双亲数
原题传送门 这题需要运用莫比乌斯反演(懵逼钨丝繁衍) 设F(t)表示满足gcd(x,y)%t=0的数对个数,f(t)表示满足gcd(x,y)=t的数对个数,实际上答案就是f(d) 这就满足莫比乌斯反演 ...