I like using Core Data object modeling, because it gives me generated code and behavior that I like.
For example, relationships with the inverse object being updated automatically.
However, for most of my projects I don't need persistent storage. Specifically, I'd like not to save all the objects I created every time I sa开发者_运维知识库ve the context.
What would be a good way to do this?
I thought of using an extra context for disposable objects.
Have you tried creating an in-memory persistent store? When you create a managed object instance, you can assign it to this in-memory store, which will not persist any data to disk, and also is reset on the next launch of your app.
Another way to go is to create a second Managed Object Context, and make sure you never save it.
精彩评论