我有兩個模型,為CE ?和DeviceInterface ,其中,CE 模型具有屬性ICollection<DeviceInterface>?DeviceInterfaces
之后我使用的是repository模式,現(xiàn)想刪除掉CE 底下的多個DeviceInterface,我是這樣做的
DeviceInterfaceRepository.Delete(DeviceInterfaceRepository.GetById(Id));?
出現(xiàn)如下錯誤
AnalysisSNMPTest.entityFrameworkTesting.TestDeleteSub:System.InvalidOperationException : Adding a relationship with an entity which is in the Deleted state is not allowed.
在此之間,我沒有使用其他Repository,特沒有讓entityFramework 讀出CE 的模型我被折磨了好久, Google出的方式好像都不是太管用,
各位拜托了,郵箱jicheng1014#gmail.com ?先謝謝了
entityFrameworks 1:n 無法刪除的問題,還請各位幫忙看下,謝謝了
慕碼人2483693
2018-12-06 15:52:34