I guess that making dependencies explicit has value in all layers, but certainly more in the domain and application layers.
The specific question I have is that I have a DomainEventStore interface defined in the domain (might be the source of the problem - not sure if it should be part of the domain since it's actually never used from any domain services like repositories are). I also have a `CommonDomainEventStore` implementation in the infrastructure layer. Now, I'd like to be able to provide a DomainEventMetadataProvider to the `CommonDomainEventStore`, but I'm really not sure where the `DomainEventMetadataProvider` interface should be defined.
I'd like the have an implementation of the `DomainEventMetadataProvider` live in the application layer, because this is the layer that should be responsible for auditing.
If I declare the `DomainEventMetadataProvider` interface in the infrastructure, then the application layer will depend on an interface in the infrastructure layer which feels weird.
If I declare the above interface in the application layer, then the `CommonDomainEventStore` will depend on domain interfaces and application layer interfaces.
If I declare this interface in the domain, it would feel weird since the `DomainEventStore` interface wouldn't depend on it, therefore there would be no guarantees that implementations would support metadata providers. I could add a method `setMetaDataProvider` on the `DomainEventStore` interface to force implementors to support a metadata provider, but now all implementations would have to become mutable.
I'm not so sure how I should define these dependencies?