Response models from external services used in Application layer? #727
Unanswered
thommelutten
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am accessing an external application to synchronize some data between my applications, and am wondering how I should go about with the implementation.
As far as I understand, all use of external services should reside in the
Infrastructure
layer, with an interface created inApplications
. But if I want to have a command that calls my external service to synchronize cases between applications, then the mapping from the response model to a model in my domain would violate the separation between Application / Infrastructure. How can I get around that?In my
Application
layer:If I want to map from the externalCase model to my own domain, it requires a
IMapFrom<ExternalCase>
, where the Application layer starts knowing about the Infrastructure layer. Which is a violation. Alternatively I should create a new domain model object in the service and pass that back like so:MyExternalService
But this also seems a bit tedious, and I would like to use the functionality of AutoMapper.
I've tried to look around a bit, and the closest response I could find was #344, but there isn't really a lot to go from in that explanation in regards to the mapping between models.
Beta Was this translation helpful? Give feedback.
All reactions