Re: Added object to MOC, why isn't this a bug?
Re: Added object to MOC, why isn't this a bug?
- Subject: Re: Added object to MOC, why isn't this a bug?
- From: "Bobby B" <email@hidden>
- Date: Thu, 1 Jun 2006 17:54:23 -0400
So would it be correct to think of it as when I add a new object, if
it's a duplicate, it merges the contents of the two objects?
Like, if I add an album with 1 song to the set, and the same album is
already there with 12 songs, I'll get a result of 13 songs?
(It seems to work like that)
Bobby
On 6/1/06, Chris Hanson <email@hidden> wrote:
On Jun 1, 2006, at 2:33 PM, Bobby B wrote:
> Thank you for this. I didn't realize that the mutable set it returned
> was tracked, I thought I would have to reset the values.
No, no need to reset.
> So in the below, when I add the newAlbum, which is a duplicate, what
> is CoreData doing behind the scenes that prevents it from adding a
> duplicate?
Generally a question of the form "what is ___ doing behind the
scenes" can't be answered in the detail the person asking may like.
In this case, the simple way to think about it is that the to-many
relationship is represented by a set (in the mathematical or
relational sense) and sets never contain duplicates. So if you add
the same object to a set multiple times, you still only have one
element in the set for it.
-- 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