Pattern Domain-Driven Design DDD
The user interface layer
Basic API :
- Controller "Sample" is used for DI & sample of CacheManager class.
- Controller "SampleAlt" is used for demonstrate the using of "services" > "repository" > "UoW" > "EF"
The data management layer
-
Use "module" conception : services interfaces with their implementation (Module : aggregates/services [DDD])
-
DTO : Data Transfer Object (sample: MyApp.Domain.DTO.SampleDataDTO).
-
The Specification Pattern (soon).
-
"Select Builder" : Thanks to LINQ you are able to create custom expression for return directly an DTO (sample: MyApp.Domain.SampleModule.Aggregates.SampleDataSelectBuilder).
The data access layer
- Use EntityFramework (EF) with DbSet/Annotations for link a SQL/Table to a class/object (sample: MyApp.Domain.SampleModule.Aggregates.SampleData).
- The Unit Of Work (UnitOfWork / UoW) Pattern add transactions for the resolution of concurrency problems (MyApp.Data.UnitOfWorkContext).
- The Repository Pattern add a layer between DbSet (return IQueryable) with UoW and the data used in "Domain" layer. Queryable manipulation is sensible, a Repository return an Enumerable or an Entity. (MyApp.Data.Core.Repository && MyApp.Domain.Core.IRepository)
The app management layer
- CrossCutting : a layer can be used in all others.
- The Inversion Of Control.
- Dependancy Injection (DI) & LifeTimeManager.