I am trying to refactor the system according to Onion Architecture approach.
My outer layer includes the following segments
WCF web service (which we provide)
infrastructure classes for DB access
infrastructure classes to access external web services
tests
I'd like to double check if different segments of the outer layer are allowed to have dependencies on each other. For example, can WCF classes directly depend on any code from infrastructure assemblies?
As far as I understand it is not allowed. E.g WCF code should only depend on code (eg interfaces) from the inner layers. Could you please confirm it?
PS
I am a bit confused because on one hand some articles confirm it:
http://blog.ploeh.dk/2013/12/03/layers-onions-ports-adapters-its-all-the-same/
You have probably noticed that I've grouped the orange, yellow, and blue boxes into separate clusters. This is because I still want to apply the old rule that UI components must not depend on Data Access components, and vice versa. Therefore, I introduce bulkheads between these groups
but on the other hand the tests (eg for code in the infrastructure assemblies) sit in the same layer as the infrastructure assemblies and have direct dependency on them.
Talking in terms of physical assemblies, infrastructure assemblies (assemblies which contain code that addresses a problem [usually] utilizing a specific framework) shouldn't reference each other directly. Instead you should aim to (at least in my experience) extract an interface from those assemblies and place them into a separate assembly which other infrastructure assemblies can reference. Using your (approximate) situation as an example, you could do something like this:
Things to note:
Global.asax
.Let me know if you need further information.