dotnet / dotnet/AspNetCore.Docs

Expand DI documentation with additional extension method overloads

Open
#6,312 17 comments 1 reaction 0 assignees View on GitHub
doc-enhancement Pri2
Dominant language
C#
Stars
13.1k
Forks
24.6k
Avg merge
1d 3h
Merged PRs (30d)
97

Description

I've recently been exploring and documenting some more "advanced" DI registration examples on my blog. I've had a few occasions where I've found that people are not aware of the additional method overloads they can use when calling AddSingleton, AddTransient etc.

I briefly chatted with @scottaddie about this gap and as agreed I'm raising an issue to discuss this further.

The current documentation I've found is in the [fundamentals section here](https://docs.microsoft.com/en-gb/aspnet/core/fundamentals/dependency-injection).

I'm opening this issue to discuss if any of the following scenarios should be considered for inclusion...

- [ASP.NET Core Dependency Injection – How to Register Generic Types](https://www.stevejgordon.co.uk/asp-net-core-dependency-injection-how-to-register-generic-types)
- [ASP.NET Core Dependency Injection – Registering Multiple Implementations of an Interface](https://www.stevejgordon.co.uk/asp-net-core-dependency-injection-registering-multiple-implementations-interface)
- [ASP.NET Core Dependency Injection – Registering Implementations Using Delegates](https://www.stevejgordon.co.uk/asp-net-core-dependency-injection-registering-implementations-using-delegates)

I accept there is a balance between showing all of the API vs making it too overwhelming for less experienced developers. I'm not sure if these would serve best as a section nearer the end of that current document, or in their own more advanced doc?

My experience to date (which may not extend to the wider .NET audience) is that people are not naturally discovering these capabilities when exploring the API directly.

If this is agreed for inclusion I'm happy to assist by reworking some of my examples and content for the docs.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.