.NET

Clean Architecture

Layered architecture, CQRS, MediatR, repository pattern, separation of concerns, testability

20 preguntas de entrevista·
Mid-Level
1

What is the Clean Architecture principle?

Respuesta

Clean Architecture organizes code into concentric layers where dependencies point only inward (toward the domain). The Domain layer (entities, business rules) has no infrastructure dependencies. Outer layers (UI, Database, API) depend on domain abstractions via Dependency Inversion. This ensures testability, framework independence, and code maintainability.

2

What are the main layers of Clean Architecture?

Respuesta

Clean Architecture has 4 main layers: Domain (entities, business rules, repository interfaces), Application (use cases, DTOs, application logic), Infrastructure (repository implementations, DbContext, external services), and Presentation (API controllers, UI). Domain is at the center and depends on nothing. Application depends on Domain. Infrastructure and Presentation depend on Application and Domain.

3

What is the CQRS pattern?

Respuesta

CQRS (Command Query Responsibility Segregation) separates read (Queries) and write (Commands) operations. Commands modify state and return void or a simple result. Queries return data without modifying state. This separation allows independent optimization of reads (Dapper, SQL views) and writes (EF Core, DDD aggregates), and different scaling for each side.

4

What is the role of MediatR in Clean Architecture?

5

How to define a Command in MediatR?

+17 preguntas de entrevista

Domina .NET para tu próxima entrevista

Accede a todas las preguntas, flashcards, tests técnicos, ejercicios de code review y simuladores de entrevista.

Empieza gratis