mercredi 28 septembre 2016

NLayered Architecture

When we start any project,  we have to think about the architecture and use the best practices and avoid the anti-pattern ( ,  To achieve layered architecture, ASP.NET  we have to follows the principles of Domain Driven Design. In Domain Driven Design there are four fundamental layers:

1- Infrastructure Layer : this layer is used to interact with Database using ORM framework,  like NHibernate or Entity Framework, it can be a Repository implementation or an implementation for an email provider to send emails.
2-Domain Layer : in this layer we find  business objects and their rules . This is the core of the application, it contain : entities, value objects, repositories, domain services, Unit of Work, Domain Events...
3- Application Layer : Interaction layer between the Presentation and Domain Layers. Orchestrates business objects to perform specific application tasks, we can use DTOs, DTO Mappers, Authorization, Session, Audit Logging...
4- Presentation Layer : that can present SPA or MVC or MVVM  web application, it's the user interface , the front-end part of any application and can be a mobile interface too. We can add in this layer : Localization, Navigation, Notifications...

We can use another Layer to expose services : WCF or Web API .
In presentation layer, we can use Web API Controllers integrated in Core web project .

0 commentaires:

Enregistrer un commentaire