Skip to main content

Nothing gets served before the machine is warm.

The async-first dependency injection container for .NET. Awaiten follows services that need asynchronous setup through your object graph and refuses to compile code that would use one too early.

A day in the shop

Follow one coffee shop from the code you write to the first cup.

BEFORE OPENING

You write the whole shop on one screen.

Registrations are attributes on a static partial class. The espresso machine only implements your own IWarmUp interface, so your domain code never references Awaiten.

[Container]
[AsyncInitializer<IWarmUp>(nameof(IWarmUp.WarmUpAsync))]
[Singleton<EspressoMachine>]
[Scoped<Order>]
[Transient<Cup>]
public static partial class CoffeeShop;
dotnet add package Awaiten
BUILD

The compiler checks the shop.

If a cup would grab the machine before it is warm, the build stops. So does a missing registration, a cycle or a singleton holding on to a scoped service. Other containers find these at startup, or in production.

// the cup grabs the machine without waiting for it
public sealed class Cup(Func<EspressoMachine> machine);
AWT119A synchronous Func relationship targets an async-initialized service. Take Func<Task<EspressoMachine>> and await it.
OPENING

The machine warms up, once.

InitializeAsync runs every async initializer in the graph. The shared espresso machine heats its boiler before anyone may use it.

await using CoffeeShop.Root shop = new();
await shop.InitializeAsync();   // the machine warms up
Singleton · asyncEspressoMachineshared by the whole shop
SERVICE

Every cup is ready.

Each order gets its own scope, like a web request. Each cup is made fresh, with a shot from the warm machine.

Cup cup = await shop.ResolveAsync<Cup>();  // a fresh cup, ready
ScopedOrder
TransientCup

Domain code stays yours

Registrations and async setup live on the container, so your services never reference Awaiten.

Plain C#, AOT clean

No reflection on any path, so native AOT and trimming just work.

Fits ASP.NET Core

The MS.DI bridge runs your container under the generic host, next to IServiceCollection.

Ready to open?

Build the coffee shop end to end, or map your IServiceCollection registrations over.