• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CoreData, reset a persistent store
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData, reset a persistent store


  • Subject: Re: CoreData, reset a persistent store
  • From: mmalc crawford <email@hidden>
  • Date: Thu, 16 Nov 2006 01:08:39 -0800


On Nov 16, 2006, at 12:07 AM, Pierre Chatelier wrote:

You're thinking about this the wrong way round; managed objects do not represent what's in the store, the store is a persistent repository for managed objects...
Ok, I understand the problem. There could be several ManagedObjectContext associated to the persistent store, so I just cannot tell "remove managed objects" because managed objects have sense only in a context, i.e. they have been fetched...
But in that case, I would like to tell the persistent store "forget all object of a given entity". And there is no method like that.


Again that's the wrong way round to think about it. Core Data is an *object graph management* and persistence framework. The store is just somewhere objects go to sleep at night. You could get away with doing what you ask in your situation because you have a single entity. In the general case, there may be several entities with relationships between them. If you want to remove all instances of an entity, then you must ensure that the resulting object graph is valid (there may be relationship constraints that need to be applied) and you can only do this by bringing into memory all the instances of the entity...

mmalc

_______________________________________________
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


  • Follow-Ups:
    • Re: CoreData, reset a persistent store
      • From: Pierre Chatelier <email@hidden>
References: 
 >CoreData, reset a persistent store (From: Pierre Chatelier <email@hidden>)
 >Re: CoreData, reset a persistent store (From: Jim Correia <email@hidden>)
 >Re: CoreData, reset a persistent store (From: Pierre Chatelier <email@hidden>)

  • Prev by Date: Re: CoreData, reset a persistent store
  • Next by Date: Re: CFRunLookFindMode crash
  • Previous by thread: Re: CoreData, reset a persistent store
  • Next by thread: Re: CoreData, reset a persistent store
  • Index(es):
    • Date
    • Thread