3

This is related to DDD for a desktop application in c#...with 4 layers ui/application/domain/infrastructure. Actually 3 desktop applications sharing part of the domain and part of the infrastructure.

In an effort to avoid developers crossing the wrong layers and using the wrong classes, I separated the layer in assemblies and set the reference/dependencies in accordance. If the infrastructure is a dll/assembly and the domain another dll/assembly and the application is an exe/assembly and the ui is a dll/assembly... then the project cannot the build. Who's gonna load the the ui.dll? Am I missing something here?

The only solution i have come with is creating a fifth layer called Program. That layer will have the entry point of the program and will wire everything together (I'm using DI with Unity )

Any idea?

svick
  • 10,137
  • 1
  • 39
  • 53

1 Answers1

2

The Program solution seems fine to me. Thats usually how it really is. And if you are worried about developers putting stuff in wrong assemblies, you should either apply some kind of code review process. Or if you want to go into extreme, separate them by "project". Eg. Domain could be it's own separate project with separate feature and bug tracking, planning, release, etc.. That is only way to actually force complete separation of the domain.

Euphoric
  • 38,149