c# - EF Core InMemory 未抛出:无法保存更改,因为检测到循环依赖
问题描述
我们有一个类似于https://github.com/aspnet/EntityFrameworkCore/issues/11888中的模型。
就像上面的问题一样,当使用 SqlServer 执行此操作时,我们会遇到异常
Unhandled Exception: System.InvalidOperationException: Unable to save changes because a circular dependency was detected in the data to be saved: 'Person [Added] <- Owner { 'OwnerId' } Car [Added] <- ActiveCar { 'ActiveCarId' } Person [Added]'.
但是,当我们使用 InMemory 数据库进行单元测试时,不会引发此异常。有没有办法通过内存数据库获得这个异常?
解决方案
推荐阅读
- swiftui - 如何使部分可协作?
- javascript - 未捕获的类型错误:SpeechKITT.displayRecognizedSentence 不是函数
- python-3.x - 如何在 Python 中使用 redshift 连接器远程运行 SQL 脚本?
- c# - 每个工作班次 C# .NET WindowsForm 客户端控件的生产摘要图表
- chatbot - 在 AIML 中如何检测像 KUKI AI 这样的用户重复词?
- android - 使用 Ktor 发送发布请求时出现内部服务器错误
- python - 列表中出现的python中的索引错误
- android - 如何从我的单元测试中删除多余的双键 (!!)?
- xamarin.forms - 如何在 Azure Notification Hub 中将 iOS 设备注册的到期日期设置为 31-12-9999 23:59:59?
- python - 超参数调优 FB Prophet 模型 - 如何在参数网格中引用 m.add_seasonality 类别