简体   繁体   English

如果我在模型中创建一个瞬态属性,那么这不是由核心数据管理的吗?

[英]If I create a transient property in the model, isn't this managed by core data then?

Just to grok this: If I had a transient property, lets say averagePrice, and I mark that as "transient" in the data modeler: This will not be persistet, and no column will be created in SQLite for that? 只是想一想:如果我有一个transient属性,可以说averagePrice,然后在数据建模器中将其标记为“ transient”:这将不会持久化,并且不会在SQLite中为此创建任何列?

And: If I make my own NSManagedObject subclass with an averagePrice property, does it make any sense to model that property in the xcdatamodel file? 并且:如果我使用averagePrice属性创建自己的NSManagedObject子类,那么在xcdatamodel文件中对该属性进行建模是否有意义? Would it make a difference if I would simply create a property in my subclass and not model that in the entity? 如果仅在子类中创建一个属性而不在实体中对该属性建模,会有所不同吗?

(I think: yes, it doesn't matter at all ... but not sure) (我认为:是的,这并不重要...但不确定)

Transient properties are handled by the undomanager for example. 例如,临时属性由undomanager处理。 In addition changing transient properties makes the document "dirty" if you work in a document based application. 另外,如果您在基于文档的应用程序中工作,则更改瞬态属性会使文档“变脏”。

Creating the property only in your subclass does not affect the whole core data stack at all. 仅在子类中创建属性根本不会影响整个核心数据堆栈。 It depends on your needs which solution to choose 根据您的需求选择哪种解决方案

Article on transient properties in core data 关于核心数据中瞬态特性的文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取核心数据以从托管对象模型创建SQLite数据库 - How do I get Core Data to create an SQLite DB from my Managed Object Model 从现有XSD创建托管对象模型-iPhone核心数据 - Create Managed Object Model From Existing XSD - iPhone Core Data 为什么调试器不知道我的Core Data生成的托管对象类上的方法? (附代码) - why isn't the debugger aware of methods on my Core Data generated managed object classes? (code attached) 在Core Data的瞬态属性的获取器中执行繁重的任务 - Performing an intensive task in the getter of a transient property in Core Data 核心数据托管 object 属性保留 - Core data managed object property retention 核心数据更新(如果存在)或创建新的托管对象。 我可以加快速度吗? - Core Data update if exists or create new managed object. Can I make this faster? 创建未保存到持久性存储的Core Data模型对象 - Creating a Core Data model object which isn't saved to the persistent store 如何识别核心数据管理对象模型-哈希? - How to identify Core Data Managed Object Model — hash? 我是否只能将复制的字符串传递给Core Data属性? - Couldn't I just pass an copied string to an Core Data property? 核心数据:创建多个托管对象,但只保存一些? - Core Data: Create multiple managed objects, but only save some?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM