Re: Overridding -[NSPersistentDocument managedObjectContext]
Re: Overridding -[NSPersistentDocument managedObjectContext]
- Subject: Re: Overridding -[NSPersistentDocument managedObjectContext]
- From: Jerry Krinock <email@hidden>
- Date: Mon, 27 Oct 2008 12:12:07 -0700
On 2008 Oct, 27, at 11:44, Andy Lee wrote:
- (NSManagedObjectContext*)managedObjectContext {
NSManagedObjectContext* moc = /* ... create your own MOC ... */;
[self setManagedObjectContext:moc];
return moc;
}
Or alternatively, if your intent is to use the inherited behavior
but do some additional stuff to the MOC:
- (NSManagedObjectContext*)managedObjectContext {
NSManagedObjectContext* moc = [super managedObjectContext];
// ... Do custom stuff to moc ...
return moc;
}
Thanks, Andy. It looks like I would then be creating a new moc, or
doing custom stuff to it, whenever this getter is invoked. No good.
I'm still not sure whether or not it is appropriate to not use super's
managedObjectContext instance variable, as proposed at the bottom of
my original post.
Jerry
_______________________________________________
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