user2527749
user2527749

Reputation: 11

DDD: using infrastructure from application service without creating abstraction in domain?

I'm following domain driven design in a new project.

I need to validate some data that I'm receiving in my application service. To validate that data I need to make an http request to a third part endpoint. Following DDD, I have implemented that request in Infrastructure layer. The problem I have now is that I don't want to create an abstraction for that implementation in the domain layer because it has nothing to do with any entity or domain logic, it's purpouse consists only to validate the data I'm receiving in the application service. Since application layer should not reference anything from infrastructure layer because is a more inner layer, and I think I should not create an abstraction in domain because doesn't fit well, how can achieve this?

Upvotes: 1

Views: 298

Answers (1)

choquero70
choquero70

Reputation: 4754

Infraestructure layer depends on Application layer also.

You can create an abstraction (interface) in Application layer, and implement it in Infraestructure layer.

And you use dependency injection at runtime.

Upvotes: 1

Related Questions