What is the most popular way to compare two core data entities to identify in the same context?
Is it ok to just use the object identity and as EntityOne == EntityTwo
I'm sure they both are in the same context? Is this, do I guarantee that for every core data unit, the maximum of one coco object is represented per-managed Oxford?
If not, what is the preferred way? In my model, every core data unit has a UUID property, I am sure there is a safe (but slow) comparison than the one. What is the best practice here (and for future generations, if there is no UUID in anybody's model What will happen?)
How about comparisons in references? [EntityOne inContext: moc] == [entityTwo in context: moc]
or similar, or is there a faster / better / more elegant way?
If you want to know that two managed objects represent the same underlying example, the right way is to Using objectID
properties is :
.
If two objects were obtained from the same context, they are actually the same object , because the core data does not create multiple objects in the same context in the same example It should be ok to use ==
in that strictly limited case. Using ==
in any other situation will give wrong results.
Comments
Post a Comment