核心数据实体的最大数量 [英] Core data max amount of entity

查看:144
本文介绍了核心数据实体的最大数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用应用程式,我使用核心资料。
我已经试图做一个实体,但是没有工作。
但是我现在有20个实体,我的问题是:实体数量或推荐数量有限制吗?

是否有更好的方法来存储这些数据? / p>

更新:



我存储的是学校的毕业生而不是A,b,c,d, e,f但是一个从1到10的数字。每个grad都有自己的称量(次数一个数的计数)像一些grad数2次,因为更多导入。

所以我第一想有一个数组,一个字符串为主题的名称,然后到数组一个商店的grad,另一个对应的称重。

像这样:

  var subjects:[String,[Int],[Int]] 

但这是不可能的,我甚至不知道我应该把这个在核心数据,并得到它正确。



因为我不能

解决方案

p>您可以设置与成绩和<$有序集的一对多关系的主题实体c $ c> Weight ,如下所示:




不过,每个级别显然具有相应的权重,因此将每个级别的权重存储在成绩实体中将更准确:




这仍然可能不代表您的真实世界模型。




  • 如果你的科目是一般的,如数学或英语,你可以有一个以上的科目每个年级(例如代数,几何,三角学),或超过一个水平每个科目(例如代数1,代数2 )。


  • 如果您的主题非常具体,您的数据可能最终分布在独特的一对一关系,而不是一对多关系。




您还需要考虑是否可以使用有序或无序关系,或是否存在可用于对实体排序的属性。



您应该考虑这些不同的方面在您尝试设计或实现模型之前,允许您有效地表示这个特定的对象图。


I am working on an app where I use core data. I already have tried to do it with one entity but that didn't work. But I now have like twenty entities and my question is: is there a limit to the number of entities or a number recommended?
Is there a better way to store that amount of data?

UPDATE:

What I am storing are grads from school but not the A,b,c,d,e,f but a number from 1 to 10. And each grad has is own weighing(amount of times a number count) like some grad count 2 time because the are more imported.
So i first thought to have an array with a string for the name of the subject and then to array one store's the grad the other the corresponding weighing.
Like this:

var subjects: [String,[Int],[Int]] 

but this isn't possible and I don't even know how I should put this in core data and get it back properly.

Because I couldn't figure it out, I thought of just making a entity for each subject but there are a lot of them so there for this question.

解决方案

You could setup a Subject entity that has one-to-many relationships to ordered sets of Grade and Weight, like so:

However, each grade apparently has a corresponding weight, so it would be more accurate to store each grade's weight in the Grade entity:

This still may not represent your real-world model.

  • If your subject is something general, like math or english, you could have more than one subject per grade, (e.g., algebra, geometry, trigonometry), or more than one level per subject (e.g., algebra 1, algebra 2) which may or may not have a different grade.

  • If your subject is very specific, your data may end up spread across unique one-to-one relationships, instead of one-to-many relationships.

You would also need to consider whether you can use ordered or unordered relationships, or whether an attribute exists that you can use to sort an entity.

You should consider these different facets of what you're trying to model (as well as the specific fetches you'd want to perform), before you try to design or implement the model, to allow you to efficiently represent this particular object graph.

这篇关于核心数据实体的最大数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆