I have an ASP.Net Core WebAPI with multiple versions and having corresponding versions of the service layer injected.
Each version has its own model version. The V1 Controller, injects V1 service layer, and uses V1 model, the service layer does the business validations.
Now comes V2 version of the controller, which injects V2 service layer and uses V2 model (inherits from V1 model).
What is the best approach that I can reuse most (if not all) of the V1 service layer business validations in V2 service layer?
Any pattern that will help out?
Structure:
-- V1 Controller
-- V1 Service Layer
-- V1 Model
-- V2 Controller
-- V2 Service Layer
-- V2 Model implements V1 Model