【发布时间】:2020-02-22 00:39:04
【问题描述】:
我的数据库中有一张表,如下所示:
Table_A
Col1 nvarchar(100)
Col2 nvarchar(100)
Col3 nvarchar(100)
现在在我的实体中:
public class Table_A
{
public string Col1 {get; set;}
public string Col2 {get; set;}
public string Col3 {get; set;}
public string Col4 {get; set;}
}
使用 EF,在某些情况下,我需要执行返回 Col1、Col2、Col3 和 Col4 的存储过程(Col4 是与其他表的左外连接中的列检索);问题是当我不使用那个 SP 时,我在 Col4 上得到一个错误。
我正在使用 EF Core 2.2.3 和 MS SQL Server 2017。
【问题讨论】:
-
您是否尝试过添加NotMapped 属性?
-
是的,不幸的是,当我使用返回 Col4 的 SP 时,属性中的值为 null。
标签: entity-framework