EF Core InMemory不抛出:由于检测到循环依赖项,因此无法保存更改

时间:2018-09-27 06:19:07

标签: c# entity-framework entity-framework-core

我们有一个类似于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数据库进行单元测试时,不会引发此异常。 是否也可以通过内存数据库来获取此异常?

0 个答案:

没有答案