Week at Work · Architecture Case Study

Modernizing a Production Scheduling Platform

How I used the migration from .NET Framework to .NET 8 as an opportunity to redesign a growing production application around Clean Architecture, CQRS, MediatR, explicit business use cases, and independently evolving presentation and infrastructure layers.

.NET 8 Clean Architecture CQRS MediatR Vertical Slices Domain-Driven Design
Product
Week at Work
My Role
Software Architect & Developer
Modernization
.NET Framework → .NET 8
Architecture
Clean Architecture + CQRS
01 — OVERVIEW

A framework migration became an architectural redesign.

As Week at Work expanded, business logic, data access, UI preparation, and request handling had become increasingly intertwined.

The original ASP.NET MVC architecture had served the platform well during its earlier stages, but the application's growing scheduling and workforce-management workflows made seemingly small changes increasingly difficult to isolate.

Rather than recreate the same architecture on a newer runtime, I used the move to .NET 8 to establish clearer boundaries between domain behavior, application workflows, infrastructure, APIs, and MVC presentation.

Upgrading the runtime and modernizing the architecture were treated as two related—but distinct—engineering problems.

02 — THE CHALLENGE

Growing business complexity was exposing architectural coupling.

Scheduling had evolved far beyond CRUD and increasingly required coordination across many independent business rules and platform capabilities.

1

Scheduling Complexity

Availability, qualifications, restrictions, validation, breaks, and shift trades all interact with scheduling workflows.

2

Large Controllers

Controllers increasingly coordinated data retrieval, authorization, business rules, persistence, notifications, and UI preparation.

3

Interface Coupling

Business workflows often existed because an MVC endpoint existed instead of being independently reusable application capabilities.

4

Multiple Clients

MVC, Web API, mobile clients, scheduled jobs, and future interfaces should be able to invoke the same business behavior.

5

Testing Difficulty

Tightly coupled workflows made individual application behaviors more difficult to exercise independently.

6

Legacy Risk

The application was already in production, making a complete rewrite an unnecessarily risky modernization strategy.

03 — ORIGINAL ARCHITECTURE

MVC controllers had become workflow coordinators.

Traditional MVC Flow

Controller HTTP + orchestration
→
Service Business operations
→
Repository Persistence
→
Database Application data

The architectural problem was not MVC itself—the problem was allowing application workflows to become defined by MVC endpoints.

04 — ARCHITECTURAL SHIFT

Move orchestration out of controllers and into explicit use cases.

Before

ScheduleController
↓
Retrieve Data
↓
Validate
↓
Modify Entities
↓
Save + Notify
→

After

MVC / API
↓
Command / Query
↓
MediatR
↓
Use Case Handler
↓
Domain + Infrastructure
05 — TARGET ARCHITECTURE

Establish explicit boundaries between application concerns.

Solution Architecture

Web Presentation Layer ASP.NET Core MVC
API Layer ASP.NET Core Web API
→
Application CQRS · Use Cases
→
Domain Business behavior
Infrastructure SQL · Services · Integrations

Domain

Contains core business models, invariants, value objects, and meaningful state transitions.

Schedules Shifts Break Rules Shift Trades Restrictions

Application

Defines supported business use cases through commands, queries, handlers, DTOs, validators, and interfaces.

CQRS MediatR DTOs Validation

Infrastructure

Implements persistence, messaging, notifications, timezone services, and external integrations.

Presentation

MVC and Web API consume application capabilities without owning the business workflows they initiate.

06 — BUSINESS USE CASES

Controllers express intent instead of implementing workflows.

Controller Publish requested
→
PublishScheduleCommand User intent
→
Handler Application workflow
→
Domain schedule.Publish()
→
Infrastructure Persist + notify

Publishing a schedule became an application capability that could be invoked from MVC, Web API, background processing, or future clients.

07 — COMMANDS & QUERIES

Separate state-changing intent from information retrieval.

Commands

Explicitly represent operations that change application state.

  • CreateShiftCommand
  • UpdateShiftCommand
  • PublishScheduleCommand
  • CreateShiftTradeCommand
  • ApproveShiftTradeCommand
  • AssignEmployeeToShiftCommand

Queries

Shape retrieval around what the consuming screen or client actually needs.

  • GetEmployeeScheduleQuery
  • GetScheduleDetailsQuery
  • GetShiftMarketplaceQuery
  • GetPendingManagerApprovalsQuery
  • GetEmployeeAvailabilityQuery
08 — READ-OPTIMIZED QUERIES

CQRS did not mean abstracting away efficient SQL.

Complex screens can use purpose-built queries and multiple result sets without forcing the write-side domain model to resemble the UI.

My Trade Requests
My Responses
Available Trades
Pending Actions
→
ShiftMarketplaceDto

The write side can prioritize domain correctness while the read side independently prioritizes retrieval performance.

09 — PRESENTATION BOUNDARIES

DTOs stop MVC-specific concerns from leaking into the application.

Domain
→
Application Query
→
DTO
→
MVC ViewModel
→
Razor View

Application queries remain reusable across MVC, Web API, mobile clients, and other consumers because presentation formatting stays outside the Application layer.

10 — DEPENDENCY INVERSION

Business workflows depend on capabilities, not implementations.

Command Handler Application
→
INotificationService Application abstraction
←
NotificationService Infrastructure implementation

INotificationService

Application notification capability.

IEmailService / ITextMessageService

External communication abstractions.

11 — CROSS-CUTTING DOMAIN CONCERNS

Timezones and localization belong at explicit boundaries.

Time Handling

Persist timestamps consistently while application timezone services convert them into location-local business representations.

UTC Storage Location Timezones DST Handling

Localization

Application workflows return stable error identifiers while presentation layers translate them using resource files and the selected culture.

Stable Error IDs .resx Resources Presentation Translation
12 — MEDIATR PIPELINE

Centralize cross-cutting behavior instead of repeating it.

Request
→
Logging
→
Authorization
→
Validation
→
Transaction
→
Handler

Pipeline behaviors reduce handler boilerplate while creating consistent validation, authorization, logging, and transaction boundaries.

13 — INCREMENTAL MIGRATION

Modernize the production system without rewriting it from scratch.

The migration strategy was designed so the platform could continue operating while architectural responsibilities moved incrementally into the new solution.

1

Establish the .NET 8 Solution

Create Domain, Application, Infrastructure, Web, API, and test projects with explicit dependency boundaries.

2

Build Shared Infrastructure

Establish the application patterns needed by future migrated features.

Dependency Injection MediatR Validation Localization
3

Migrate by Business Feature

Move functionality as vertical slices instead of attempting a single application-wide rewrite.

Break Scheduling Shift Trades Time Off Availability
4

Retire Legacy Responsibilities

As workflows move into commands, queries, and application services, legacy controllers and services progressively become thinner and removable.

14 — ARCHITECTURAL TRADEOFFS

More structure introduces more ceremony.

Cost

A simple feature may now involve a command, handler, validator, DTO, mapping configuration, and tests instead of one controller method and a service call.

Benefit

As workflows become more complex, those explicit boundaries make dependencies and business intent visible instead of hiding them inside large controllers and general-purpose services.

CQRS was used selectively as an organizational strategy, not as a requirement to make every application operation unnecessarily complex.

15 — DESIGN PRINCIPLES

Architectural principles that guided the modernization.

Business Capabilities First

Application workflows should exist independently of the HTTP endpoint or client that initiates them.

Explicit Use Cases

Commands and queries make the platform's supported business operations immediately visible.

Domain-Owned State Changes

Meaningful entity transitions remain close to the business state and rules they protect.

Optimize Reads Independently

Query models can use purpose-built SQL without distorting transactional domain models.

Depend on Abstractions

Application behavior depends on capabilities while Infrastructure supplies replaceable implementations.

Migrate Incrementally

Production systems can evolve feature by feature instead of accepting the risk of a complete rewrite.

16 — TECHNOLOGIES & PATTERNS

Modern .NET with explicit architectural boundaries.

Technologies

.NET 8 ASP.NET Core MVC ASP.NET Core Web API C# MediatR SQL

Architecture & Patterns

Clean Architecture Dependency Inversion Domain-Driven Design Repository Pattern Dependency Injection
17 — OUTCOME

A clearer foundation for the next generation of the platform.

The redesign shifts Week at Work from an MVC-centric application toward a platform whose business capabilities exist independently of their presentation layer.

Smaller Controllers HTTP endpoints express intent instead of coordinating complex workflows.
Explicit Use Cases Commands and queries make business capabilities easier to discover and reason about.
Better Testability Application workflows can be exercised independently from MVC and infrastructure implementations.
Multiple Interfaces MVC, API, and future clients can share the same application capabilities.
Optimized Reads Complex screens can use purpose-built SQL and dedicated read models.
Incremental Evolution Features can migrate independently while the production platform continues operating.
The most important lesson was that upgrading a framework and modernizing an architecture are two different problems.

Explore More of My Work

See additional system design, scheduling, and software architecture case studies.