Hosting
An Awaiten container runs on its own: create the root and resolve from it. ASP.NET Core, the generic host and worker services expect Microsoft.Extensions.DependencyInjection (MS.DI) instead. The Awaiten.Extensions.DependencyInjection package hands your container to the host, and imported services let your container use what the host registers, such as its logger or configuration.
Pick the page for your task
| You want to | Explained on |
|---|---|
| Hand your container to ASP.NET Core or the generic host | MS.DI bridge |
| Use services that the host registers inside your Awaiten graph | External services |
Move an existing IServiceCollection setup to Awaiten, at once or one service at a time | Migrating from MS.DI |
Three ways to hand a container to the host
The bridge offers three entry points. The MS.DI bridge compares them in detail.
AddAwaitenContaineradds the container to a service collection, such asbuilder.Services, next to the host's own registrations. It is also the way to migrate one group of services at a time.AwaitenServiceProviderFactoryfits a host that builds its provider through a factory.AwaitenServiceProviderlets the container answer every request, when nothing but the container registers services.
Where to go next
- MS.DI bridge for a complete ASP.NET Core app.
- External services to pull the host's logger or configuration into your graph.
- Migrating from MS.DI to move your registrations over.