• 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: Why no -[NSManagedObjectContext deleteObjects:] ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why no -[NSManagedObjectContext deleteObjects:] ?


  • Subject: Re: Why no -[NSManagedObjectContext deleteObjects:] ?
  • From: Bill Bumgarner <email@hidden>
  • Date: Sun, 2 Sep 2007 11:43:12 -0700

On Sep 2, 2007, at 4:14 AM, Conor wrote:
Deleting an object from a managed object context is relatively cheap
as it does not impact the persistent store.

But not when it comes to bindings. Deleting one object will send
notifications around. I have to unbind an NSArrayController and then bind it
back up after the enumeration in order to perform a delete of several
objects. NSManagedObject should definitely have a deleteObjects: to avoid
that issue. All that said I would recommend you file an enhancement request
with Apple's bug tracker.

The model layer should not add API to optimize a behavior of the control layer. Instead, the control layer should provide mechanisms for optimized interaction with the underlying model layer.


And, indeed, it appears that NSArrayController has API to do exactly that:

- (void)remove:(id)sender; // overridden to remove the selected objects
...
- (void)removeObjectAtArrangedObjectIndex:(unsigned int)index; // removes from the content objects and the arranged objects (as specified by index in the arranged objects)
- (void)removeObjectsAtArrangedObjectIndexes:(NSIndexSet *)indexes;
- (void)removeObject:(id)object; // removes from the content objects and the arranged objects (if currently contained)
- (void)removeObjects:(NSArray *)objects;
...


I have no idea if said methods are optimized for efficient interaction with the model layer (haven't parsed that code in a while), but -- if not -- they would be a much more appropriate target for a bug report than filing an enhancement request against the model layer (CoreData).

b.bum
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Why no -[NSManagedObjectContext deleteObjects:] ? (From: Conor <email@hidden>)

  • Prev by Date: Re: Temporary files best practice?
  • Next by Date: Re: core data app questions - help!
  • Previous by thread: Re: Why no -[NSManagedObjectContext deleteObjects:] ?
  • Next by thread: NSBezierPath append CGGlyph
  • Index(es):
    • Date
    • Thread