DEV Community

Cristian Sifuentes
Cristian Sifuentes

Posted on

C# Architecture Mastery — Clean Architecture in ASP.NET Core: Minimal APIs vs MVC (Part 4)

C# Architecture Mastery — Clean Architecture in ASP.NET Core: Minimal APIs vs MVC (Part 4)

C# Architecture Mastery — Clean Architecture in ASP.NET Core: Minimal APIs vs MVC (Part 4)

Clean Architecture is framework-agnostic.

ASP.NET Core is framework-heavy.

So the real question is not “Which framework should I use?” but:

How do I apply Clean Architecture without letting the framework leak inward?

In this Part 4, we’ll compare Minimal APIs vs MVC through the lens of Clean Architecture, not personal preference.


1. Clean Architecture Rule #0 (The One That Matters)

Frameworks are details.

ASP.NET Core is an outer-layer concern.

If your domain or application layer knows about:

  • Controllers
  • HTTP attributes
  • Model binders
  • IActionResult

Then Clean Architecture is already violated.


2. Where ASP.NET Core Belongs in Clean Architecture

In Clean Architecture, ASP.NET Core lives in:

  • Interface Adapters
  • Frameworks & Drivers

Never in:

  • Domain
  • Application (Use Cases)

ASP.NET Core should:

  • Accept input
  • Call application services
  • Return output

Nothing more.


3. Minimal APIs — What They Really Are

Minimal APIs are thin HTTP endpoints, not “simpler MVC”.

app.MapPost("/orders", async (CreateOrderRequest request, IMediator mediator) =>
{
    await mediator.Send(request);
    return Results.Ok();
});
Enter fullscreen mode Exit fullscreen mode

Strengths

  • Extremely thin
  • Low ceremony
  • Easy to keep logic out

Risks

  • Logic creeping into lambdas
  • Overgrown endpoint files
  • Poor organization without discipline

Minimal APIs reward architectural discipline.


4. MVC Controllers — What They Really Are

MVC controllers are adapters, not business logic containers.

[ApiController]
[Route("api/orders")]
public class OrdersController : ControllerBase
{
    private readonly ICreateOrderUseCase _useCase;

    public OrdersController(ICreateOrderUseCase useCase)
    {
        _useCase = useCase;
    }

    [HttpPost]
    public async Task<IActionResult> Create(CreateOrderRequest request)
    {
        await _useCase.Execute(request);
        return Ok();
    }
}
Enter fullscreen mode Exit fullscreen mode

Strengths

  • Familiar structure
  • Clear separation by convention
  • Better for large teams

Risks

  • Fat controllers
  • Business logic leakage
  • Framework-first thinking

MVC protects structure, but does not enforce purity.


5. The Real Difference (Architectural Perspective)

Concern Minimal APIs MVC
Ceremony Very low Medium
Structure You design it Convention-based
Discipline required High Medium
Scaling teams Harder Easier
Clean Architecture fit Excellent (if disciplined) Excellent (if disciplined)

The framework is not the deciding factor.

Discipline is.


6. The Correct Clean Architecture Flow

Regardless of framework:

HTTP
  ↓
Controller / Endpoint
  ↓
Application Use Case
  ↓
Domain
  ↓
Infrastructure (via interfaces)
Enter fullscreen mode Exit fullscreen mode

If your flow looks different, stop and refactor.


7. Common Anti-Patterns (Seen in Production)

❌ Domain referencing ASP.NET Core

❌ Controllers calling DbContext directly

❌ Minimal API lambdas containing business rules

❌ MVC filters used for business logic

❌ HTTP models reused as domain entities

These scale badly.


8. A Clean Setup Example (High-Level)

src/
 ├─ Domain/
 ├─ Application/
 ├─ Infrastructure/
 └─ Web/
     ├─ Controllers/ (or Endpoints)
     ├─ Program.cs
     └─ DependencyInjection.cs
Enter fullscreen mode Exit fullscreen mode

Framework stays at the edge.


9. Senior-Level Decision Guide

Choose Minimal APIs when:

  • You want maximum control
  • You enforce architecture via reviews
  • You build focused APIs or microservices

Choose MVC when:

  • You have large teams
  • You want convention over configuration
  • You need filters, formatters, and tooling

Both are valid.

Neither excuses bad architecture.


Final Thoughts

Clean Architecture is not about MVC vs Minimal APIs.

It’s about dependency direction.

ASP.NET Core is powerful—but dangerous if it leaks inward.

Master this, and frameworks stop owning your system.

✍️ Written by Cristian Sifuentes — building ASP.NET Core systems where architecture, not frameworks, drive decisions.

Top comments (0)