If you never heard about the “Onion Architecture”, you should read Jeffrey Palermos blog post. He’s the Onion-Architecture-Guru 😉
I created a very small demo VS.NET solution, which shows how I would apply this type of architecture in a project. (The download link is at the bottom of this post.)
The following graph displays the dependencies between the VS.NET projects.
My Core contains two libraries:
OnArch.Core | Is the main core library and contains the business logic and the interfaces for all outer layers. This project doesn’t contain any references to technology specific assemblies like EF etc. |
OnArch.Core.Entity | Contains only the entities. It’s allowed to place entity-specific logic inside the entity classes. But I would prefer to place all logic in the OnArch.Core project. The reason why I placed the entities in a separated project is: Sometimes you may need only the entities and not the whole application logic etc. For example, when you have a WCF service and a .NET WCF client and you don’t want to generate proxy classes. (You see an example in my demo solution.) |
You see in the graph, that all projects in the outer layers are referencing the core libraries. And not vice versa. I’ve excluded the DependencyResolution project because of the clarity of the graph.
As a reference, I posted here the real “Onion”. 🙂
The first version of my demo solution can be downloaded here:
Onion Architecture V 0.1 |
.