user1127850
user1127850

Reputation: 125

In Domain Driven Design the factory classes can access to infraestructure?

If necessary, a factory can access elements of the infrastructure to build an object?. In a particular case, I have an object that I need to add email signature that is stored as a parameter in the configuration layer of the application.

Upvotes: 0

Views: 258

Answers (2)

GeertPt
GeertPt

Reputation: 17854

In DDD, a Factory is at the same architectural level as a Repository, but for creating new objects instead of loading existing objects. So it can call infrastructure services just like the repository.

Upvotes: 1

Dennis Traub
Dennis Traub

Reputation: 51634

There is no one correct answer to this problem. If the factory itself is part of your application layer this should be fine. You can also add an application service that hands the email signature down into your domain when needed.

Upvotes: 0

Related Questions