Using third-party containers
Though the built-in container is sufficient for most of our scenarios, .NET 6 provides a way to integrate with third-party containers that can be leveraged if need be.
Let's have a closer look at how the framework wires up the services. When the Startup class is registered with HostBuilder in Program.cs, .NET Framework uses reflection to identify and call the Configure and ConfigureServices methods.
Here is a snippet from the LoadMethods method of the StartupLoader class in ASP.NET Core 6 (refer to the code from https://github.com/dotnet/aspnetcore/blob/main/src/Hosting/Hosting/src/Internal/StartupLoader.cs):
public static StartupMethods LoadMethods(IServiceProvider hostingServiceProvider, [DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)] Type startupType, string environmentName, object? instance = null)
{
var configureMethod = FindConfigureDelegate(startupType, environmentName);
...