Talk

Modularity Without Microservices in ASP.NET Out of the Box

In Russian

Microservice architecture has become mainstream, but it’s often chosen "for future growth" without a real need for dozens of teams and languages. The price? Increased latency, distributed complexity, cascading failures, and the inability to run everything locally with a single button press. What if you have just one team, one database, but more microservices than CPU cores? What if your code is written in C#, not six different languages?

There is an alternative: the modular monolith. It's a single application in a single process, but its internals are split into independent modules with well-controlled boundaries. This approach gives you low coupling and high cohesion within modules — without network calls, serialization, or distributed transactions. And the best part: ASP.NET Core supports this out of the box.

In this session, we'll explore with real code:

  • How to selectively load modules using IHostingStartup and HOSTINGSTARTUPASSEMBLIES without changing the entry point code.
  • How to register MVC controllers, Minimal APIs, and Razor Pages from each module using ApplicationParts and IStartupFilter.
  • How to build a modular data model with EF Core: IEntityTypeConfiguration, composing a single DbContext, migrations, and relationships between entities across different modules.
  • How not to break the architecture: Roslyn analyzers and runtime dependency checks.
  • How to package everything into a single Docker image with multi-stage builds and run one or multiple modules via environment variables.

Outcome: You'll get a ready‑to‑use architecture that's equally convenient for development (F5, debugging, unit tests) and production (single container, module‑based scaling). And most importantly — you won't pay the "microservices tax" from the very first line of code.

This talk is aimed at architects and lead developers who want a balance between monoliths and microservices using only the standard capabilities of .NET.

Speakers

Talks