What's the recommended folder structure of catalogs in project using IoC
What I usually do is that I have a MyApplication.Core
(Class library) layer, which contains all the applications interfaces with as little (read: none) third-party dependencies, e.g. ILogger
, ICommand
or IQuery<TResult>
.
Next I have a MyApplication.Domain
(Class library) layer which contains all the application domain specific knowledge - this is the business layer. This is implementations of the core interfaces ICommand
, IQuery<TResult>
. These implementations then have an dependency on e.g. ILogger
. Never concrete implementations.
Then I have the MyApplication.Infrastructure
(Class library) which is where all the service interfaces from MyApplication.Core
is implemented, e.g. ILogger
. Here you can have dependencies on third-party libraries such as Log4Net.
Then last I have the presentation layer, which is in my case usually an MVC applications so I would name this MyApplication.Web.Mvc
. All controllers have only dependencies on the interfaces. Never concrete implementations. This layer is also responsible of bootstrapping all the interfaces to the concrete implementations using a Composition Root.
TL;DR:
- MyApplication.Core (Application Interface Layer)
- MyApplication.Domain (Business Logic)
- MyApplication.Infrastructure (Implementations of Application Interface Layer)
- MyApplication.Web.Mvc (Presentation and Composition Root Layer)