Open kazemihabib opened 6 years ago
Jesse recommends otherwise: https://github.com/square/moshi/issues/453#issuecomment-368563445
todo-mvp data package seems to imply that the data model for remote and local sources be the same "task" model (which is what brought me to this comment)
thanks for the info, i'll use separate models too
Different models looks nice, but having complex models with multiple nesting levels seems to be a pain in the ass. As such, when requesting data from network, it may respond with a json mapping pagination and other stuff inside (which is needed by ViewModel to load more data). Having a Repository with local & remote dataSources looks like is kinda ruined (local responds with List of Objects, remote responds with class that contains the List of Objects). All sample apps that I've seen demonstrates using simple POJOs (which in production code is almost never realistic). Any idea on solving this architecture puzzle?
Im facing the same dilemma in bringing room and retrofit together. It works fine for simple objects but as my model start to be complex, i was forced to use different models for local and remote. What is really a pain...
I have to agree with @DoruAdryan on this. The complex data reference rules of Room really seem to make it infeasible to use Room with Retrofit. I really miss some sort of support for stubbed relationships for complex data models, so the same model can be used for both if it contains object relations.
Im facing the same dilemma in bringing room and retrofit together. It works fine for simple objects but as my model start to be complex, i was forced to use different models for local and remote. What is really a pain...
What is the correct way of using two different models? I need some guidance please? Can you explain a bit?
Leaving a tactical dot (.) here. Been scratching my head on this exact same issue for a while now.
I am encountering the same issue, does everyone just have two different data models one for Retrofit and one for Room?
Hi,
I had the same problem and I found the solution in a Google public course:
Actually they recommend to have three kind of models (with extension methods to convert them) to achive entity decoupling:
hope this will help someone
Is it a correct pattern to use a same model for both Retrofit and Room library as it's done in GithubBrowserSample sample?