![]() | ensuring data is unique |
|
09 Feb 2013, 02:51
Tim West (4 posts) |
In section 4.3 when talking about fetching data you describe how to get only NSManagedObjectIDs and how this is a super fast way to query the database. I am wondering if you could elaborate on the use of this method to check if an object with a certain identifier is already in the object graph and if it is load the full object. Would NSManagedObjectID be a good way to do this? If so what would the implementation look like? |
|
13 Feb 2013, 18:31
Marcus S. Zarra (239 posts) |
First, I would not recommend using the I would recommend creating your own non-changing unique identifier and then executing a count against it and then reacting based on the results of that count. |
|
16 Feb 2013, 21:12
Tim West (4 posts) |
Thanks Marcus – when you say issuing a count that involves setting up a fetch request for the unique identifier and checking if we get any objects right? |
|
18 Feb 2013, 16:52
Marcus S. Zarra (239 posts) |
Close, it would be something like:
You could also pre-fetch the unique rows if you knew which ones you were going to be processing:
Then you end up with a dictionary |
| You must be logged in to comment |

