I am building a project with the Web API and for this I am building on the Onion architecture.
To separate the layers I am using the Repository Pattern (Repository Pattern) for accessing data and one layer above is the services layer.
In the service layer I inject the repositories and in that way I can do a CRUD in a very clean way and everything is perfectly separate.
What I do not like is that when I have to make a more complicated operation with linq
as a join
, first I have to call the Repository of table X and execute a Get
to get data, then I have to do that same operation with the Repository of table Y.
Once I have this data I can do a join
, this is not optimal since before doing the join
I have to make 2 calls to the database to get the data.
I have searched on Google but I can not find a solution for this design flaw, has anyone else encountered this problem? What solution have you implemented?