Skip to content
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

Other options for entity mapping? #95

Open
ehsankalafchi opened this issue May 31, 2020 · 1 comment
Open

Other options for entity mapping? #95

ehsankalafchi opened this issue May 31, 2020 · 1 comment

Comments

@ehsankalafchi
Copy link

In this sample there are at least three sets of Entites: Data layer entities (mapped to REST api or database: MoveEntity), Domain layer entities (Movie) and view layer entites (MovieView). For each entity to flow from data layer to view layer two mappers are needed. Two other mappers are needed for reverse direction, which are not provided in this sample because only read scenarios are implemented. It means that four mappers are involved in moving data through layers back and forth. Adding a new field require all of them to change as well. This can become a maintenance problem. I have two questions regarding this issue:

  1. Where is the best place to implement mapping logic?
  2. What are other options? (maybe some kind of automatic mapping?)
@aaghan
Copy link

aaghan commented Jun 9, 2020

it is just an example. You can use single entity class on all the layers you want or define the specific entity depending on each layer. I prefer to use the minimum number of entity unless the case of re-usability which makes easier for clean-code.

I've a case on creating the multiple entity for distinguished feature-modules, where I created the new entity in ViewModel of the base module where the feature module was required to be implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants