当我向真实的数据库查询时
context.Entities.Where(e => e.Owner.Id == ownerId)
我可以肯定不会发生任何错误,因为不会使用任何实际对象,并且这将转换为某些SQL请求。但是本地缓存呢?
context.Entities.Local.Where(e => e.Owner.Id == ownerId)
我可以确定即使我不是Include
所有者,也不会抛出NRE吗?还是我应该使用
context.Entities.Local.Where(e => e.Owner?.Id == ownerId)