Re: CoreData, reset a persistent store
Re: CoreData, reset a persistent store
- Subject: Re: CoreData, reset a persistent store
- From: Chris Hanson <email@hidden>
- Date: Thu, 16 Nov 2006 09:09:56 -0800
On Nov 16, 2006, at 4:33 AM, Pierre Chatelier wrote:
Cascading deletions per se is not the issue; the issue is whether
the resulting object graph is in a valid state. This can only,
in the general case, be determined by having the objects in memory.
I do not understand why you must have the objects in memory to know
if this is a valid state... I was expecting the persistent store to
be able to understand relationships, but perhaps it's not the case ?
Relationships are not the only way to determine validity. You can
also have business logic that determines whether individual objects
are valid and/or whether an entire sub-graph of objects is valid.
(Consider what happens if you allow the object graph to be saved in
an invalid state, for example if the destination of a required
relationship is not present:
Do you mean, for instance, the following :
-Let's suppose I have a persistent store containing two types of
entities A and B, with relation ships between them
-Let's suppose the persistent store allows me to delete all entities
of type A.
-if I remove all entities A in the persistent store, only the
managedObjectContext is able to determine cascading deletions. The
persistent store does not know which B entities were connected and
should be removed ?
When you attempt to save the managed object context, it will check not
just the validity constraints that are specified in your managed
object model, but also any validity constraints that are implemented
in code using NSManagedObject's validation methods.
-- Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden