-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mapping but not store #104
Comments
Hello, @vishaldeshai FEM currently supports only mapping to either NSManagedObject or to the NSObject. Therefore it looks like that you're looking for a NSObject mapping. |
Suppose i have array of dictionary then?? |
@vishaldeshai are you trying to map an array of dictionaries to the NSManagedObject's property? |
I have array of dictionary and i got that from web service but i dont want to store that on Core data but only need to mapp is it possible??? |
Sure. You may want to map them to the plain nsobject's that you have. |
NSObject is super class for either nsaray or nsdictionary. so we need to iterate everydictionary and map to FEMMaping right?? |
Nope, you just need to map that exactly as you would do this for the CoreData except a different initializer for the Mapping. Can you share sample json and a desired output? |
I have two types of Visit Like Plan and Unplan. i am storing and mapping Plan Visit after Login but i dont have to store unplan Visit for my application. Json for Plan and plan visits are same. So what is the desirable solution?? |
You can either provide an NSObject duplicate for the Visit or to store them in the in-memory / nested managed object context that should not be saved to the database. |
Can you elaborate more?? Json are same means format are same but values are different. :) |
I can't get what you mean. If the format is the same, than you should be able to map them to the same entity Visit. What I'm proposing is remove saving of the context after mapping. in this case you can get all of the results in memory. Another way is to provide NSObject's subclass with the same properties that you have for the Visit and map json to it. |
I have already created Coredata ManagedObject Subclass. |
I've made a request and can not understand what is your issue. Do you want to prevent to store response in the database? |
Yes |
As I already said you should either save objects into the nested context without saving or to provide class with duplicated set of the properties, that you have on the CoreData's model. In this way you'll get an array of NSObject's subclasses. |
nested context means how?? |
You can read it here: In short nested context will still be used in the same way as using plain managed object context but not saving it. One sec:
With the code above FEM will map, but won't save result to the database. i.e. |
where to use mapping object in your code?? |
@vishaldeshai I've updated my comment, please check it out. |
saveContextOnCommit saves the object in coredata |
@vishaldeshai hello. |
Hello, |
How are you fetching those objects? Most likely that they're temporary. Try to close your app right after |
that objects are feting from server. |
I meant how did you figure out that objects are in the database? |
For me, there is two scenario like i am store some objects in db and some objects are not mapping but not store. once i ma fetching stored object then also got mapped object(i.e i mensioned above) |
@vishaldeshai can you show the output of the debugger command:
Please, run it on a clean install. |
@vishaldeshai |
Hello,
I have Core Date entity and store array of data but now i want to create array of data with the use of FastEasyMapping but dont want to store inside DB.
Thanks in advance.
The text was updated successfully, but these errors were encountered: