核心数据中的根实体
我基本上试图使用核心数据重新创建文件夹系统。我有一个拥有许多相同实体(文件夹)的实体(文件夹)。在初始化核心数据堆栈的同时,我可以显示所有文件夹,但是我不确定如何处理始终持久的核心数据实体,该核心数据实体将是所有其他文件夹的“根”文件夹。 (将其视为Finder中的“ Macintosh HD”)。
我正在考虑创建一个没有删除规则的单独的根实体,并将其算作“根”文件夹,然后将文件夹添加到它(创建一个新文件夹时,我可以使用核心数据关系提供的函数并添加到root Entity中)。这可以是一种适当的方法吗?
I'm basically trying to recreate a folder system using Core Data. I have an entity (folder) that that holds many of the same entities (folders). While initialising Core Data Stack I can display all of the folders, but I'm not sure how to approach storing an always persistent Core Data entity that will be a "root" folder for all others. (Think of it as 'Macintosh HD' in finder).
I was thinking of creating a separate root entity that has no deletion rule and count it as "root" folder and then add folders to it (while creating a new folder I could just use functions provided by Core Data relationships and add to the root entity). Could this be a proper approach?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论