即使在将属性数据属性设置为“ NotMapped”之后,也会获得“无效的列名...”

时间:2019-06-06 21:02:28

标签: c# entity-framework sqlexception

我不确定为什么,但是在尝试获取“产品”时

return context.Products.SingleOrDefault(m => m.Id == id);

我收到一个Sql异常,上面写着“无效的列名'DefendantId1'。'

不确定名称后面为什么有1,也不确定为什么我未设置属性后出现此错误

我的Property对象中有

public class Product
{
    // other props here
    [NotMapped]
    public int DefendantId { get; set; }
}

0 个答案:

没有答案