Dragon Fire

Layers

Web View Models (Javascript), Views (HTML/CSS), Localization
Web Api Web API Controllers, MVC Controllers, Localization
Application Application Services, DTOs, DTO Mappers
Domain Entities, Value Objects, Repositories, Business Classes, Domain Services, Unit of Work, Domain Events
Entity Framework ORM, DB Migrations, Filters

Others

Core
Dependency Injection Using Autofac
Mapping Using Automapper
Global Exception Handling And Logging For Web Api
Workers
Worker Api
The differences between a domain service and an application services are subtle but critical: • Domain services are very granular where as application services are a facade purposed with providing an API. • Domain services contain domain logic that can’t naturally be placed in an entity or value object whereas application services orchestrate the execution of domain logic and don’t themselves implement any domain logic. • Domain service methods can have other domain elements as operands and return values whereas application services operate upon trivial operands such as identity values and primitive data structures. • Application services declare dependencies on infrastructural services required to execute domain logic. • Command handlers are a flavor of application services which focus on handling a single command typically in a CQRS architecture.
1. Distinguish Model and View Model. Entities should always be valid. There should be no method able to put it in an invalid state. Oh! you just set its properties in the form? This is not DDD. This is CRUD with Anemic Domain Model. View Model can be validated using validation attributes and any other nice way. You should return the list of broken validation rules rather than throw exceptions. 2. Distinguish Validation Rules and Business Rules. This first are context-free, can be checked on client side, they are about the form(at) (data making sense) rather than content (command can be processed). Business rules should be checked in entities methods that are the only way of changing their state. So you provide valid arguments to the method and it decides if they are also acceptable. If not, the exception is one of the ways of communicating it. But you can also consider alternatives, like domain events.