Replies: 2 comments 11 replies
-
Let me rephrase your question to see if I got it. So you use namespaces and assemblies as two orthogonal dimensions to divide up your application: you use namespaces for the business areas and assemblies for the technical layers, right? Unfortunately this structure doesn't make it possible to use NsDepCop for controlling dependencies between technical layers, because those are not identified by namespaces, but by assemblies. And NsDepCop checks dependencies only between namespaces. I see a couple of options though. (1) Use some other tool for controlling dependencies between assemblies. (2) Reorganize namespaces so you can use them to represents both domain (business area) and technical (layer) aspects.
This approach has the benefit that you can define much more fine grained dependency rules between namespaces than it would be possible with just assemblies.
I've got a blog post that further elaborates on this topic: https://realvizu.com/2018/02/03/implementing-ddd-bounded-contexts-with-csharp-namespaces-and-dependency-rules/
|
Beta Was this translation helpful? Give feedback.
-
Nuget released: https://www.nuget.org/packages/NsDepCop/2.5.0 |
Beta Was this translation helpful? Give feedback.
-
Hi there.
In my projects I'm following the domain driven design paradigma and name the system namespaces without including any technical aspects like Service, BusinessLogic and Repository (a classic 3-layer architecture). Of course the technical implementations (layers) of the domain models are isolated via different assemblies but living within the same namespace.
For example:
To my question: How would you ensure the integrity of the layers if you want prohibit a reference from, for example, the layer MyCompany.Repository.dll to MyCompany.ServiceContract.dll?
Beta Was this translation helpful? Give feedback.
All reactions