-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Description
Description
User feedback transferred from UUF System:
"Where's the example? There's a lot of setup in the DI paradigm that is difficult to understand. An example is worth much more than pages of documentation. That said, the explanation appear to be thorough, but putting it all together will be difficult (it has been in my experience with DI)."
The following Problem/Solution is just an AI generated recommendation and should be treated as such:
Problem Statement
The current documentation for .NET Generic Host provides thorough explanations of individual concepts and includes isolated code examples for specific features. However, it lacks a comprehensive, end-to-end example that demonstrates how to set up a complete application with dependency injection using the Generic Host. Users find it difficult to understand how all the pieces fit together, particularly regarding the DI setup process.
Proposed Solution
Add a new section titled "Complete Example: Generic Host with Dependency Injection" that provides a full working example of a simple application using Generic Host with dependency injection. This example should demonstrate:
- Creating and configuring the host
- Registering different types of services (transient, scoped, singleton)
- Consuming those services in a hosted service
- Handling lifetime events
Suggested Changes
Add the following section after the "Manage the host lifetime" section (around line 1060):
Page URL
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/host/generic-host?view=aspnetcore-9.0
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/host/generic-host.md
Document ID
2373a3df-6ea3-50c7-d63d-61c51d572511
Platform Id
a08460ca-4764-dd6a-f8ee-95d128928047
Article author
Metadata
- ID: c5f1eeee-d500-82bf-0d0a-b4e0d5d5c175
- PlatformId: a08460ca-4764-dd6a-f8ee-95d128928047
- Service: aspnet-core
- Sub-service: fundamentals