DEV Community

Discussion on: A production-level architecture for Android apps (part 2)

Collapse
 
4gus71n profile image
Agustín Tomas Larghi

but i guess it would neither be correct to do this management from UseCase/Interactor because that would expose how is database implemented. What do you think about it?

I don't see why it would be a bad idea having a InsertUserWithAddressUseCase which internally uses two different DB repositories.

I'm going to guess that the technology that you're using for the database layer is Room. This is a very brute, raw example of how that would look like, let me know if it fits your needs, or if you're looking for something else:

gist.github.com/4gus71n/2c0b0fe131...

A note though:

  • I guess that you actually have a more complex situation going on, but if you actually need to just insert one record that has a one-to-many relationship there are way easier ways to do it than the one above.