Need to get to the foreign keys of an entity marked as "Deleted" for auditing
Posted
by Abhijeet Patel
on Stack Overflow
See other posts from Stack Overflow
or by Abhijeet Patel
Published on 2010-04-11T06:33:33Z
Indexed on
2010/04/11
6:43 UTC
Read the original article
Hit count: 205
entity-framework
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 entities 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?
© Stack Overflow or respective owner