I came across an architecture for a .net application where there are 3 layers
Repository layer (edmx and their classes)
^
|
V
Domain layer (Model -> Interfaces and their implementation)
^
|
V
Web layer (Model -> View models)
Communication between the web and the data layer takes place via Interfaces defined in the domain layer (anemic models)
The naming convention used over here is all dependent on table names
Repository layer
TableNameRepository.cs
TableName.cs (autogenerated files)
DomainLayer
ITableName.cs
TableName.cs
TableNameService.cs
Web layer
TableNameListModel
TableNameAddEditModel
The problem with this is that if a column is modified in the table, the classes in repository and domain layers all need re-work.
Also, communication between these layers take place with managers which have been resolved as below, where Container
is static
Container.Resolve<RepositoryManager>();
Container.Resolve<ServiceManager>();
The DBContext
is stored in session variables during the first call and removed at the end of the request. The second call will initialize the DBContext with the new
operator.
Any suggestions on what can be done (with minimal changes) so as to imporve this architecture so that it aligns with DDD.
TableName.cs
: do they have behavior or only data?TableNameService.cs