I faced some problems when generating a database schema from commercial objects with EF Core:
- There is no support for structure properties
- There is no support for the properties of the interface
- I need additional columns that should belong only to the data layer.
I do not want to change my business layer (structures / interfaces to classes) only by EF, since this goes against the principles of clean architecture (the framework should serve its application, not the other way around). In addition, adding persistence-specific columns to the business layer is out of the question.
I guess the right thing to do is add persistence objects to the persistence layer that would represent entities in the business layer.
In addition to that, some mappers would have to be used by the business layer to abstract the persistence objects that assign them to commercial entities.
Few questions about this approach:
- Is this right to do? Is there an alternative? For example: The EF configuration capabilities that would help me solve the problems listed above without replicating entities in the persistence layer?
- This feels like a lot of repetitive code and the replication of the same properties. It seems that this code could be generated automatically by some tool, is there something like this?
- Is there a good example of how such an approach should look?