Clean Architecture & Microservices Interview Questions (.NET)
10 Clean Architecture & Microservices questions from the .NET track. Read each short answer here, then open a question for the full explanation, examples, common mistakes, and sources.
- Senior
How do you organize Clean Architecture layers in .NET Enterprise solutions?
Split the solution into four projects: Domain (entities and pure business logic), Application (use cases and interfaces), Infrastructure (databases and APIs), and WebApi (Controllers), with dependencies always pointing inward.
Read the full explanation - Mid-level
What is CQRS, and how does MediatR help separate reads and writes in C# projects?
It separates state-changing operations (Commands) from data retrieval (Queries); MediatR is an in-process message dispatcher that connects each request to its own IRequestHandler.
Read the full explanation - Senior
What are MediatR Pipeline Behaviors, and how do they implement Aspect-Oriented Programming (AOP)?
They intercept each IRequest before it reaches the Handler and implement cross-cutting tasks such as FluentValidation, logging, caching, and transaction management.
Read the full explanation - Senior
How do Entities, Value Objects, and Aggregate Roots differ in DDD?
An Entity has a persistent unique identity (Id), a Value Object is defined by its values and has no identity, and an Aggregate Root is the leading entity that maintains consistency for its entire group.
Read the full explanation - Senior
What is Event Sourcing, and how do event stores differ from traditional databases?
Instead of storing only the current state, the system records every change as an immutable historical event (Append-Only Event) and rebuilds the current state by replaying the event stream.
Read the full explanation - Senior
What is the Dual-Write problem, and how does the Transactional Outbox pattern with MassTransit solve it?
It happens when saving to a database and publishing to RabbitMQ/Kafka together, with one of the operations failing; Outbox saves the message in a local table within the same transaction, then publishes it later.
Read the full explanation - Mid-level
How do you design Resilience Pipelines with Polly v8 integrated into .NET 8?
Use Microsoft.Extensions.Resilience to combine Retry, Circuit Breaker, Timeout, and Rate Limiter strategies in a unified, flexible pipeline for network calls.
Read the full explanation - Mid-level
How do you build fast gRPC services in .NET, and what do .proto files do?
They define strongly typed service and message contracts in .proto files, and the C# compiler generates fast base classes that communicate over HTTP/2 using compact binary serialization.
Read the full explanation - Senior
How do you implement Distributed Tracing with Activity and OpenTelemetry in .NET?
Activity is .NET's built-in representation of a Span; OpenTelemetry collects request paths across services and propagates the standard traceparent header between servers.
Read the full explanation - Senior
What is .NET Aspire, and how does it simplify building and monitoring distributed Cloud-Native applications?
It combines local service orchestration (Orchestration), preconfigured components with resilience best practices (Components), and a central diagnostics dashboard.
Read the full explanation