What does -setPropagatesDeletesAtEndOfEvent: actually do?

Let me try: if I do not install this, then the default is YES. So, when I remove a managed object from the context, does the context immediately propagate this to persistent storage so that the object does not disappear?

And when I set this to NO, are objects removed from persistent storage only when -save is called?

It's true? I mean: if this is true, then the default behavior is that after calling the context to delete the object, the object does not work. Suppose you are not using a cancellation manager. So ... gone. Right? Not possible rollback? Or can it be restored with a rollback?

0
source share
1 answer

This determines whether the deletion propagates during the change event, i.e. after calling the didChange... method (explicit or synthesized.)

As far as I know, this only affects flags on objects in memory that mark them as deleted or not. This only affects how the context controls objects in memory, and not how the context controls disk deletion. If set to YES, this causes the context to mark the objects as deleted and treat them as deleted from the graph of objects. However, canceling cancels the flag in the same way as if you deleted the object directly.

This flag is available because there may be a time when you need objects to hang for a while even after the delete or cascade relationship has ended. When NO, the context will return the "deleted" object to the point of the next save.

This is an advanced feature and is rarely used.

+1
source

Source: https://habr.com/ru/post/915657/


All Articles