前言

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

解决方法

通过查询官网文档,发现,原因在于EF Core目前不支持延迟加载,所以每次查询,都会得到 null 的导航属性。目前只有使用 预先加载 或 显示加载 才能得到正确的导航属性。

最后我使用显示加载成功得到导航属性的数据,具体使用方法可进官网文档查看。

Entity Framework Core导航属性加载问题的更多相关文章

  1. Entity Framework Core 导航属性 加载数据

    Loading Related Data https://docs.microsoft.com/en-us/ef/core/querying/related-data Eager loading me ...

  2. 浅谈Entity Framework中的数据加载方式

    如果你还没有接触过或者根本不了解什么是Entity Framework,那么请看这里http://www.entityframeworktutorial.net/EntityFramework-Arc ...

  3. Entity Framework 4.1 : 贪婪加载和延迟加载

    这篇文章将讨论查询结果的加载控制. EF4.1 允许控制对象之间的关系,当我们进行查询的时候,哪些关系的数据将会被加载到内存呢?所有相关的对象都需要吗?在一些场合可能有意义,例如,当查询的实体仅仅拥有 ...

  4. 关闭Entity Framework的导航属性

    public RIS30Entities() : base("name=RIS30Entities") { this.Configuration.ProxyCreationEnab ...

  5. Entity Framework Core 1.1 Preview 1 简介

    实体框架核心(EF Core)是Entity Framework的一个轻量级,可扩展和跨平台版本. 10月25日,Entity Framework Core 1.1 Preview 1发布了. 升级到 ...

  6. 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 ...

  7. Entity Framework Core 1.1 升级通告

    原文地址:https://blogs.msdn.microsoft.com/dotnet/2016/11/16/announcing-entity-framework-core-1-1/ 翻译:杨晓东 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. windows下多个python版本共存,如何在Windows7系统上安装最新的64位Python3.6.2

    windows下多个python版本共存,如何在Windows7系统上安装最新的64位Python3.6.2 1.官网下载python3.6.2https://www.python.org/ftp/p ...

  2. Python+OpenCV图像处理(十三)—— Canny边缘检测

    简介: 1.Canny边缘检测算子是John F. Canny于 1986 年开发出来的一个多级边缘检测算法. 2.Canny 的目标是找到一个最优的边缘检测算法,最优边缘检测的含义是: 好的检测- ...

  3. 使用隐含参数testMappingSpeed排查GoldenGate抽取慢的步骤

    OGG经典抽取模式读取redo慢的检查步骤,可以采用以下几个步骤来排查. 步骤一,确认是否抽取进程的写入有问题 1. 在原有抽取进程上,执行如下命令,统计抽取进程的效率 GGSCI> stats ...

  4. Oracle笔记 #01# 简单分页

    rownum是Oracle为查询结果分配的有序编号(总是从1~n).言下之意,rownum字段本来并不存在于表中,而是经查询后才分配的. 举一个例子: SELECT rownum, name, pri ...

  5. 在idea中不出现大波浪的设置

    在idea中如果有重复代码时候,就会出现大波浪 ,然后,现在可以设置  Duplicated Code 的对号去掉就可以没有大波浪

  6. kivy中size和pos的使用

    kivy中位置和大小属性的使用: -------------------位置---------------------------- 1.pos_hint(‘x-axis-key’:value,’y- ...

  7. leetcode [34] Find First and Last Position of Element in Sorted Array

    Given an array of integers nums sorted in ascending order, find the starting and ending position of ...

  8. 纯CSS打造萌萌哒大白

    HTML部分: <body> <div id="baymax"> <!-- 定义头部,包括两个眼睛.嘴 --> <div id=" ...

  9. win7搭建pyqt4开发环境

    版本 win7 64bit python2.7 https://www.python.org/ftp/python/2.7.13/python-2.7.13.amd64.msi pyqt4 https ...

  10. linux /Android 平台下使用 i2c-tools

    下载源码将 i2c-tools 代码下载到 Android 源码的 external 目录下 在 i2c-tools 目录下新建 Android.mk 文件,内容如下: # external/i2c- ...