How to manually manage Core Data relationships when deleting

Posted by Simon on Stack Overflow See other posts from Stack Overflow or by Simon
Published on 2009-08-13T08:54:29Z Indexed on 2010/03/16 19:31 UTC
Read the original article Hit count: 268

Filed under:
|

I have a Core Data entity, which contains a relationship to another entity. Under certain circumstances, I need to delete the managed objects in the relationship, and at other times no action needs to be taken.

I have the Delete Rule on the entity is No Action because of this manual management.

The problem I have is, where is the best place to enforce these rules? I cannot see any suitable messages to override on NSManagedObject (something that might notify the object it has been deleted and should clear up its relationships).

I would rather not do it higher up in the application logic, because the entity objects can get deleted from array controllers and at different points in the applications, making it necessary to stuff relationship update code at all those levels.

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about core-data