问题
I see some samples referencing the Domain Layer from DAL. I see that the repository interfaces are defined in the Domain Layer and since the DAL implements them, they need to reference the Domain Layer. The DAL also needs to know the Entities to return so the reference upstream. I thought that we only reference "downstream", can someone explain?
回答1:
Yes, that's OK.
Think about it like this:
If you are going to change (replace) any layer, what layer will it be? It's highly unlikely that you'd change your domain layer, since that would change your entire application. If you change the DAL, then you shouldn't need to modify the domain layer.
So, it's a good thing that your domain does not depend on anything. Your DAL can depend on your domain since your domain is the meat of your application.
I have written an article about this which explains this in more detail:
http://www.kenneth-truyers.net/2013/05/12/the-n-layer-myth-and-basic-dependency-injection/
回答2:
The Domain is located downstream.

See Onion Architecture
来源:https://stackoverflow.com/questions/24232068/ddd-does-dal-access-domain-layer