我有一个惰性加载禁用的数据库上下文。当我想使用以下代码查询和具体化某些实体时:
if (Score == 5) {
btnQuestion.disabled = true;
txtQuestionFeedback.innerText = "Correct! \n Congratulations,you've got 5 stars!";
imgScore5.src = "Images/StarOn.gif";
document.getElementById(btnReset).innerHTML = btnReset;
}
我收到以下异常:
await context.Files.Include(f => f.Owner).Where(f => ids.Contains(f.Id)).ToListAsync();
当我在查询中包括其他导航属性,但没有包括所有者时,它可以正常工作。 这同样适用于启用了延迟加载的上下文,在该上下文中,查询具体化了实体并解析了包含所有者的导航属性。
在懒惰加载禁用上下文中,导航属性所有者只是一个问题。
这是我的模型设置:
The specified navigation requires a navigation source of a type that is
compatible with 'Transient.reference[library.Client]'.
Parameter name: from
不仅对于文件,而且与用户有关的其他实体也会发生此问题。