Introduction
ImmediatePlatform is a suite of source-generated .NET libraries for Vertical Slice Architecture, CQRS, validation, minimal APIs, caching and dependency injection.
ImmediatePlatform offers libraries that make implementing the Vertical Slice Architecture, CQRS pattern and Validation in .NET easier. You can think of the ImmediatePlatform suite as an alternative to MediatR/Mediator, FluentValidation and ASP.NET Core Minimal APIs/Controllers.
What “source generated” buys you
Every package in the suite is a Roslyn source generator. None of them scan assemblies, build expression trees, or look types up by name at runtime — they read your code at compile time and write ordinary C# next to it. That has four practical consequences:
- No reflection and no startup scanning. The generated registration methods are literal
lists of
services.Add(...)calls. Startup cost is the cost of running them. - AOT- and trimming-friendly. There are no dynamic type lookups for the trimmer to fail on.
- Mistakes are build errors. A behavior whose constraints don’t match, a handler with the wrong return type, a validator missing a required method — all of these fail the build with a specific diagnostic instead of surfacing at runtime.
- You can read and debug the output. The generated pipeline is C# you can step through.
See How source generation works for the details, including how to inspect the generated files.
You don’t have to adopt all of it
The libraries are opt-in and mix freely with things you already use. All of these are supported combinations:
- Immediate.Handlers behind ASP.NET Core Controllers, with no Immediate.Apis
- Immediate.Handlers + FluentValidation, with no Immediate.Validations
- Immediate.Injections alone, with no mediator anywhere in the project
- Immediate.Apis + Immediate.Handlers + DataAnnotations
Please see our full cookbook for all integration examples.
Which package do I want?
| I want to… | Package |
|---|---|
| Decouple callers from handlers without a runtime mediator | Immediate.Handlers |
| Add logging, telemetry or transactions around every request | Immediate.Handlers — behaviors |
| Stream results back as they are produced | Immediate.Handlers — streaming handlers |
| Validate requests without writing validator classes by hand | Immediate.Validations |
| Turn a handler into an HTTP endpoint | Immediate.Apis |
| Cache a query’s response in memory | Immediate.Cache |
| Register ordinary services with DI by attribute | Immediate.Injections |
| Run work in the background on a schedule | Immediate.Jobs |
The libraries
Immediate.Handlers
- Implementation of the mediator pattern in .NET using source-generation.
- Support for implementing the Command and Query Responsibility Segregation (CQRS) pattern with minimal boilerplate.
- Support for addressing cross-cutting concerns via behaviors.
- All pipeline behaviors are determined and the call-tree built at compile-time; meaning that all dependencies are enforced via compile-time safety checks.
- Behaviors and dependencies are obtained via DI at runtime based on compile-time determined dependencies.
- Implementation that does not rely on the service locator anti-pattern.
Immediate.Apis
- Source generator for Minimal APIs for Immediate.Handlers
- Allows for easily mapping handlers to endpoints, individually or in route groups
Immediate.Validations
- Source generator for validating Immediate.Handlers handlers parameters
- Built for maximum performance and minimal boilerplate validation
- A library of built-in validators, plus your own
Immediate.Cache
- Collection of classes that simplify caching responses from Immediate.Handlers handlers.
- Backed by
IMemoryCache; concurrent requests for one key coalesce onto a single handler execution.
Immediate.Injections
- Source generator for registering non-IH handler classes with MSDI.
- Supports keyed services, open generics, factories and proxies.
Immediate.Jobs
- Reflection-free background job scheduler for .NET built on Immediate.Handlers.
- Generates typed schedulers, payload metadata, and dependency-injection registrations at compile time.
- See the Immediate.Jobs manual for scheduling, workflows, storage, operations and testing.