entity-framework-core - 审核对自有实体 Entity Framework Core 所做的更改
问题描述
我有两个实体 Employer 和 Address
public class Employer
{
public int Code { get; set; }
public string Initials { get; set; }
public string Description { get; set; }
public virtual Address Address { get; private set; }
}
public class Address
{
public string Email { get; private set; }
public string City { get; private set; }
public string PostalCode { get; private set; }
public string AddressLine { get; private set; }
}
我有一种方法可以跟踪两个实体的更改以进行审计。我想跟踪所拥有类型的更改,但我得到了
" System.InvalidOperationException: 正在使用 'Property' 方法访问实体类型 'Employer' 上的 'Address' 属性,但在模型中定义为导航属性。使用 'Reference' 或 'Collection' 方法访问导航属性。"
关于如何解决这个问题的任何想法?
解决方案
推荐阅读
- javascript - 当状态更新为与 redux 相同的值时,组件未更新
- python - 无法提交hackerrank问题以确定分数变化
- mongodb - 与 MongoDB 的大量连接
- javascript - 如何选择最新的文件?
- terminal - 银联卡和JCB卡是否使用相同规格的EMV卡?
- python - 如何将 Pandas DataFrame 中字典的字符串表示形式转换为新列?
- android - url 未显示 android React Native
- monodevelop - 由于未知原因,单击按钮会关闭我的窗口。我怎样才能解决这个问题?
- java - Jetpack Navigation - 添加 nav_graph.xml 时如何处理依赖警告?
- firebase - 如何使用“firebase 函数:shell”调用 HTTPS 函数?