开发者

Need to get to the foreign keys of an entity marked as "Deleted" for auditing

开发者 https://www.devze.com 2022-12-26 03:50 出处:网络
I\'m using v1 of EF(.NET 3.5 SP1). I\'m subscribing to the SavingChanges event of the ObjectContext wherein I audit deletes for a particular entity type. I need to get to the foreign keys of the entit

I'm using v1 of EF(.NET 3.5 SP1). I'm subscribing to the SavingChanges event of the ObjectContext wherein I audit deletes for a particular entity type. I need to get to the foreign keys of the entity being deleted i.e EntityKeys of the related entities (RelatedEnds) but the EntityKeys of the related e开发者_JAVA技巧ntities are nulls.

Is there any way to get to the foreign keys of an entity which has been marked for deletion? Does EF null out the EntityKeys of all RelatedEnds for an entity which has been marked for deletion? If so, is there a way I can get hold of the foreign keys?


I finally found an answer on the MSDN forums. http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/e4c4739f-731a-491a-a4c9-eb3c91f7c7eb

0

精彩评论

暂无评论...
验证码 换一张
取 消