I am using Microsoft ASP.NET Web API 2 and one of my end points has to internally invoke a legacy non-Microsoft web service (not asmx
or svc
) .
Which layer should I invoke this in?
I currently have :
Repository layer: where all the CRUD calls to DB are done now.
Domain Manager: where respective manager classes invoke the Repository Layer
methods.
And my Web API Controller methods invoke the respective Domain Manager methods.
Should I just have another method in my Repository Layer which invokes the web service? And follow the usual pattern above?
The repository layer is the logical place to put it; the data that you’re pulling back from the web service will need to be wrapped in domain-specific abstractions, so (in concept) it is essentially another data store alongside your own databases.