我使用 SelfTracking 实体,一切正常,直到我们在参考详细信息表中添加了一些字段。我不知道引用外键有什么问题!我还没有设计数据库模式,但我可以看到一切看起来都不错!
这是堆栈跟踪的异常消息。
A circular relationship path has been detected while enforcing a referential integrity constraints. Referential integrity cannot be enforced on circular relationships.
System.Data.Entity
Void FixupForeignKeysByReference(System.Collections.Generic.List`1[System.Data.Objects.EntityEntry])
at System.Data.Objects.EntityEntry.FixupForeignKeysByReference(List`1 visited)
at System.Data.Objects.EntityEntry.FixupForeignKeysByReference(List`1 visited)
at System.Data.Objects.EntityEntry.FixupForeignKeysByReference(List`1 visited)
at System.Data.Objects.EntityEntry.FixupForeignKeysByReference()
at System.Data.Objects.ObjectStateManager.FixupKey(EntityEntry entry)
at System.Data.Objects.EntityEntry.AcceptChanges()
at System.Data.Objects.EntityEntry.ChangeObjectState(EntityState requestedState)
at System.Data.Objects.ObjectStateManager.ChangeObjectState(Object entity, EntityState entityState)
at Aitisi.Data.Model.SelfTrackingEntitiesContextExtensions.ChangeEntityStateBasedOnObjectState(ObjectContext context, IObjectWithChangeTracker entity) in D:\Workfile\Web Projects\Allatini_Egrisis_Aitiseis\Aitisi.Data.Model\AitisiSelfTrackModel.Context.Extensions.cs:line 732
at Aitisi.Data.Model.SelfTrackingEntitiesContextExtensions.HandleEntity(ObjectContext context, EntityIndex entityIndex, RelationshipSet allRelationships, IObjectWithChangeTracker entity) in D:\Workfile\Web Projects\Allatini_Egrisis_Aitiseis\Aitisi.Data.Model\AitisiSelfTrackModel.Context.Extensions.cs:line 597
at Aitisi.Data.Model.SelfTrackingEntitiesContextExtensions.ApplyChanges[TEntity](ObjectContext context, String entitySetName, TEntity entity) in D:\Workfile\Web Projects\Allatini_Egrisis_Aitiseis\Aitisi.Data.Model\AitisiSelfTrackModel.Context.Extensions.cs:line 85
at Aitisi.Data.Model.SelfTrackingEntitiesContextExtensions.ApplyChanges[TEntity](ObjectSet`1 objectSet, TEntity entity) in D:\Workfile\Web Projects\Allatini_Egrisis_Aitiseis\Aitisi.Data.Model\AitisiSelfTrackModel.Context.Extensions.cs:line 41
at Aitisi.Repository.Data.MtrLinesRepository.Update(MTRLINES mtrLine) in D:\Workfile\Web Projects\Allatini_Egrisis_Aitiseis\Aitisi.Repository.Data\MtrLinesRepository.cs:line 37
这是我第一次面对这种错误。任何帮助表示赞赏。
谢谢你。