I have an entity, Exchange. Exchange needs to populate a list of a VOs, CurrencyPair, at startup. The collection of CurrencyPair is stored in database as master data, and has a repository called ICurrencyPairRepository to get all the available currency pairs. So I will like to get the CurrencyPair collection in the Exchange entity once the app starts.
My question is, can I directly inject the ICurrencyPairRepsoitory's implementation into the Exchange? Or should there be an Infrastructure service implementation that get the CurrencyPairs from the repository?(Ofcourse the ICurrencyPairRepository interface is inside the domain layer, it's implementation is in infrastructure layer)
Or should I inject an application service in Exchange? Are we allowed to inject only Domain Service into an Entity or other services/repositories can be injected too?
Use case:
At start up time, the exchange needs to get all the currency pairs that are allowed to be traded in the application. Whenever a new order comes in to Exchange, it contains the currency pair which it wants to trade. The Exchange then needs to check whether this currency pair is allowed to be traded or not. If yes, it forwards the order, otherwise, discards the request.
As Exchange is an aggregate root, I can initialize it from where the application starts and provide it with a set of currency pairs, but I am interested to know what is allowed to be injected in an entity which is also the aggregate root in this case.