Unique CoreData objects by attribute

I have a graph with one kind of object called Message. A message can have children, so the graph is a tree. Each object on the chart contains an attribute value; it is a kind of UUID (globally unique), so the repository cannot contain several messages with the same UUID (this uuid is a string taken from the message data, so I can not replace it using the objectID nsmanagedobject). The problem arises when I need to check the nesting of objects in the repository. How to check if a message with the same UUID is present in the repository? I am thinking about fetching a request for validateForInsert: event, but it seems too slow / complicated when there are a lot of objects to insert (around 30k in my case). Does anyone have a better solution?

+3
source share
4 answers

This is a known limitation with CoreData (I submitted the request for the function myself). You should also go to http://bugreport.apple.com and tell them that you want this feature. (Original error identifier: rdar: // 3711805)

NSManagedObjects. NSMutableDictionary, , ( , ). , . , . , / .

, .:( .

+4

, , . - , :) 30 000 , , . , . CoreData , objectID . - : - , , uuid - , NSManagedObject uuid , ( db) - , , , ,

. 30k 30k, , coredata, 30k (, , 30k ). 60k + ( ).

NSMutableDictionary, uuid NSManagedObjectID URI (, NSData) . : - objectForKey: uuid , , coredata - , . , - objectForKey: parentuuid , , . , NSPersistentCoordinator managedObjectIDForURIRepresentation: NSManagedObject ( ) ,

5 , ( 2 ).

0

( Roland Cocoa -dev), - CoreData, , X. , ([ctx save:]), 500/1000 ( , , : http://dl.dropbox.com/u/103260/CoreDataTreeTest3.zip)

30 000 :

  • CoreData X : 5-6
  • CoreData 500 : 30
  • CoreData : 2

.

: http://cocoawithlove.com/2008/03/testing-core-data-with-very-big.html

it should be faster, and 30k objects for CoreData objects. I would try to fill out a bug in the bugreporter and listen to what Apple Engineers say.

0
source

Source: https://habr.com/ru/post/1732575/


All Articles