InvalidOperationException when calling SaveChanges in .NET Entity framework

后端 未结 8 1225
小蘑菇
小蘑菇 2020-12-03 17:22

I\'m trying to learn how to use the Entity framework but I\'ve hit an issue I can\'t solve. What I\'m doing is that I\'m walking through a list of Movies that I have and ins

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-03 18:07

    I had the similar issue with table relationship spanning three levels Like Customer->Order->Order-Details with oracle 12C Auto-ID Trigger for key generation. Insertion using SaveChanges() was throwing System.InvalidOperationException.

    Solution: Augmenting function SaveChanges(System.Data.Objects.SaveOptions.None) prevents system to use temporary EntityKeys in state of object graph and in result exception is avoided.

提交回复
热议问题