[英]NSTreeController produces a delay when removing a node
I use NSTreeController
+ NSOutlineView
to display a large tree (with over 1K nodes). 我使用
NSTreeController
+ NSOutlineView
来显示一棵大树(节点超过1K)。 The tree is constructed with an adjacency list. 该树是用邻接表构造的。 In
NSTreeController
is turned on a LazyFetching. 在
NSTreeController
中打开了LazyFetching。 When I try to remove a node NSTreeController
starts to fulfill all fault descendant nodes. 当我尝试删除节点时,
NSTreeController
开始满足所有故障后代节点。 It produces a delay if a tree is large. 如果树很大,则会产生延迟。
The fulfill log is the following: 满足日志如下:
2015-03-10 17:10:22.945 TreeTest[1909:303] CoreData: sql: SELECT 0, t0.Z_PK FROM ZENTITY t0 WHERE t0.ZPARENT = ?
2015-03-10 17:10:22.946 TreeTest[1909:303] CoreData: annotation: sql connection fetch time: 0.0007s
2015-03-10 17:10:22.947 TreeTest[1909:303] CoreData: annotation: total fetch execution time: 0.0012s for 0 rows.
2015-03-10 17:10:22.947 TreeTest[1909:303] CoreData: annotation: to-many relationship fault "children" for objectID 0x100568450 <x-coredata://5DB6B2D8-646B-4D2B-ACEA-86E91B6523FB/Entity/p3390> fulfilled from database. Got 0 rows
Is it a normal behavior ? 这是正常现象吗? How can I prevent it ?
我该如何预防呢?
Actually it is not a problem of NSTreeController
. 实际上,这不是
NSTreeController
的问题。 It is how Core Data
works when a NSManagedObject
is being deleted. 这是删除
NSManagedObject
时Core Data
工作方式。 If you have in your entity relations with delete rule eq 'cascade' it loads all related objects (or fulfills fault objects) for such entity and then deletes them one by one. 如果您在实体中与删除规则eq'cascade'有联系,它将为该实体加载所有相关对象(或满足故障对象),然后将其一一删除。
So if you use 'cascade' rule and sqlite backend, Core Data
applies 'cascade' rule by itself and does not relay on backend. 因此,如果您使用“级联”规则和sqlite后端,则
Core Data
本身会应用“级联”规则,并且不会在后端中继。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.