Nic Hubbard
Nic Hubbard

Reputation: 42139

Core Data delete rules, delete all relationships and entities (many to many)

I am having a hard time understanding how Core Data Delete Rules work. I have a House Entity has 2 many to many relationships. The related entities also have their own relationships to other entities.

When I delete the House entity I want to delete all entities that are in relationship to the parent (Room, Door, Window and Decks), and all the entities in relation to those sub entities.

enter image description here

What kind of delete rule do I need for something like this?

Upvotes: 1

Views: 784

Answers (1)

ystack
ystack

Reputation: 1805

The delete rule you are looking for is Cascade
If you want a behavior wherein on deletion of House all other entities are deleted, then you'll need to setup Cascade delete rule on the both ends of the relationships.

Upvotes: 2

Related Questions