.NET › Generic Host
How does the Generic Host's DI container differ from a full-featured third-party container in terms of the features it deliberately omits?
AdvancedAnswer
The built-in container prioritizes simplicity, performance, and broad framework compatibility over advanced features found in containers like Autofac -- it deliberately doesn't support features like property/method injection, multiple constructor resolution with fallback, decorators/interceptors as first-class concepts, or child containers with fine-grained override scoping, reflecting a deliberate design philosophy that the vast majority of applications don't need this complexity, and teams that do can swap in a third-party container via UseServiceProviderFactory without losing compatibility with the rest of the Generic Host ecosystem.
// Built-in container: simple, fast, but limited feature set
builder.Services.AddScoped<IEmailSender, SmtpEmailSender>(); // constructor injection only
// For advanced features, swap the underlying container entirely:
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
builder.Host.ConfigureContainer<ContainerBuilder>(cb => cb.RegisterModule<AdvancedModule>());Real-world example A team initially frustrated by the built-in container's lack of decorator support learns this is an intentional simplicity trade-off, and adopts Scrutor (a library adding decorator/scanning extensions to the built-in container) rather than switching to a full third-party container for just this one feature.