Best practice of data persistence

2

When it comes to persisting data with Core Data . What is the best way to persist the data?

For example:

  

I have an object Pessoa (subclass of NSObject ). And at the time of   persistence I "convert" PessoaMO (subclass of    NSManagedObject ).

What I wanted to know, is basically the following:

The correct way to do this, is like the example quoted above or directly with NSManagedObject without having the class Pessoa (subclass of NSObject )?

    
asked by anonymous 20.11.2014 / 17:54

1 answer

1

This solution seems to disrespect DRY (Do not Repeat Yourself) because in addition to a duplication in the code the classes PersonMO and Person will be dependent. (Any change in one breaks the other).

A solution would be several user with NSManagedObjectContext's to make a better control of what will be persisted and what will be discarded. (I believe that's what you're doing.)

    
27.01.2016 / 18:37