核心数据“使用基本数据类型的标量属性”复选框 [英] Core Data "use scalar properties for primitive data types" check box

查看:122
本文介绍了核心数据“使用基本数据类型的标量属性”复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在创建 NSManagedObject 对象期间,我应该何时检查对原始数据类型使用标量属性?

我会花费多少钱(我的数据库能提高性能还是更轻量级)?

When should I check "use scalar properties for primitive data types" during creating NSManagedObject objects?
What it will cost me (will my data base improve performance or be more lightweight)?

推荐答案

在iOS 5和OSX 10.7标量属性不能自动生成之前,你必须添加setter和getter实现,这会导致一些惩罚。自动生成的属性已优化。我不知道任何其他惩罚。

Before iOS 5 and OSX 10.7 scalar properties can't be auto-generated and you had to add setter and getter implementations, which cause some penalty. Auto-generated properties are optimized. I'm not aware of any other penalties.

标量和非标量属性在DB中由相同的类型表示,因此DB的大小不会改变。  

Scalar and non-scalar properties are represented by the same types in DB, so there will be no change in DB's size. 

根据您要访问这些属性的方式,您应该选择何时使用标量。例如,如果要将其添加到collection(NSArray,NSSet,NSDictionary),则需要在可可对象中包装标量属性。

You should choose when to use scalar depending on the way you're going to access these properties. For example, you will need to wrap scalar properties in cocoa object if you're going to add them to collection (NSArray, NSSet, NSDictionary).

这篇关于核心数据“使用基本数据类型的标量属性”复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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