Intro
I'm creating an app and I'm not sure if the structure of the solution is correct. I have a BaseController
that uses generics. This controller is inherited by others that do not have to reimplement the code and just add functionality. The BaseController
uses an IRepositoryService
that has common logic to interact with our database using generics too and serves as a base class for other services like our CarService
that has additional logic to make a Car
interact with the database.
Doubts
Then we have a SolutionService
(and here is the part I have more doubts) that implements ICarService
, IBikeService
,ITruckSevice
, etc. The SolutionService
implements them by just having the same methods' signatures and then actually calling the corresponding CarService
's method for example. All of these services inherit from RepositoryService
, including the SolutionService
.
Advantages
In doing things like this, we can create any XController
that inherits from the BaseController
and uses the SolutionService
abstracting everything. In turn, each service can call the RepositoryService
and abstract the database interaction logic.
Question
I think this can be improved, maybe I'm even doing something wrong as I'm new in designing a whole solution. Particularly I find it odd having to add the signatures manually to the SolutionService
, maybe it could be improved through generics, interfaces, or something else? Or maybe the general approach is wrong. All feedback is welcome.