核心数据:暂态值dirty对象

时间:2022-08-19 13:02:14

I'm using transient values to provide some data within my application. The trouble is, as soon as these values are calculated, it dirties my Managed Objects, reporting that a re-save is necessary.

我正在使用瞬态值在我的应用程序中提供一些数据。问题是,一旦计算出这些值,它就会弄脏我的托管对象,报告说需要重新保存。

Is there anyway to prevent transient values from marking an object as dirty if there are no actual changes to the object graph.

如果对象图没有实际变化,是否存在防止瞬态值将对象标记为脏的方法?

Thanks,

谢谢,

2 个解决方案

#1


1  

Check out this awesome post on transient properties in core data. It explains things far better than I can in this short space, plus I'm still getting my head around this!

看看这篇关于核心数据中的瞬态特性的文章吧。它比我能在这么短的空间里更好地解释事情,而且我还在思考这个!

This guy recommends using an IsValid flag and a Snapshot ivar to deal with this issue, I think.

我认为,这个人建议使用IsValid标志和ivar来处理这个问题。

#2


1  

Could you declare the fields as unmanaged properties in your data model class (i.e. they are defined in the source code, but not included in the data model)?

您是否可以将字段声明为数据模型类中的非托管属性(即它们在源代码中定义,但不包括在数据模型中)?

#1


1  

Check out this awesome post on transient properties in core data. It explains things far better than I can in this short space, plus I'm still getting my head around this!

看看这篇关于核心数据中的瞬态特性的文章吧。它比我能在这么短的空间里更好地解释事情,而且我还在思考这个!

This guy recommends using an IsValid flag and a Snapshot ivar to deal with this issue, I think.

我认为,这个人建议使用IsValid标志和ivar来处理这个问题。

#2


1  

Could you declare the fields as unmanaged properties in your data model class (i.e. they are defined in the source code, but not included in the data model)?

您是否可以将字段声明为数据模型类中的非托管属性(即它们在源代码中定义,但不包括在数据模型中)?