Skip to content

Testably/Awaiten

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Awaiten

Nuget Build Quality Gate Status Coverage

The async-first dependency injection container for .NET.

Awaiten is a Roslyn source generator that wires your object graph at build time. There is no runtime reflection, the generated code is plain readable C#, and your container is native-AOT clean. The configuration is verified by the compiler: missing, cyclic, ambiguous, and lifetime-mismatched registrations are build errors.

Its headline feature is async initialization. Services that need asynchronous setup after construction, like opening a connection or handshaking with hardware, are tracked through the graph. Reaching one before it is ready is a compile error.

Quick start

using Awaiten;

[Container]
[Singleton<EspressoMachine>]
[Scoped<Order>]
[Transient<Cup>]
public static partial class CoffeeShop;

await using var shop = new CoffeeShop.Root();
await shop.InitializeAsync();        // async-initialized services are warmed up
var cup = shop.Resolve<Cup>();

Install with:

dotnet add package Awaiten

Features

  • Async initialization. IAsyncInitializable services are initialized in dependency order, and reaching one synchronously is a compile error.
  • Compile-time safety. Around 70 diagnostics turn wiring mistakes into build errors instead of startup crashes.
  • No reflection. The generated code is plain C#, so the container is native-AOT clean and trim-safe.
  • A full toolbox. Lifetimes, scopes, keyed services, decorators, composites, open generics, collections, factories, modules, assembly scanning, property injection, and Owned<T> for disposable transients.
  • MS.DI interop. A separate package bridges into Microsoft.Extensions.DependencyInjection for ASP.NET Core and the generic host.

Packages

Package Description
Awaiten The core: attributes, the source generator, and the runtime seams. No third-party dependencies.
Awaiten.Extensions.DependencyInjection Microsoft.Extensions.DependencyInjection interop (ASP.NET Core, generic host, and other containers).

Documentation

Full documentation lives at docs.testably.org/Awaiten.

About

The async-first dependency injection container for .NET.

Resources

License

Code of conduct

Contributing

Stars

1 star

Watchers

1 watching

Forks

Sponsor this project

 

Contributors

Languages