Aspnetcore.docs: Expand DI documentation with additional extension method overloads

Created on 9 May 2018  Â·  15Comments  Â·  Source: dotnet/AspNetCore.Docs

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.

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

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.

P2 doc-enhancement

Most helpful comment

Thanks, @Rick-Anderson! No pressure there then! :-) I'll see if I can get an initial outline and content in via PR before I travel next week for a conference. Failing that I'll get something in ASAP afterwards,

All 15 comments

@danroth27 Thoughts on what type of content you'd like @stevejgordon to contribute?

@stevejgordon you've been approved by non other than @davidfowl

Thanks, @Rick-Anderson! No pressure there then! :-) I'll see if I can get an initial outline and content in via PR before I travel next week for a conference. Failing that I'll get something in ASAP afterwards,

@stevejgordon anything to report?

@Rick-Anderson Sorry for the delay. I started work on this but got somewhat sidetracked by other things. I'd like to find time to pick it up again but I'm due to take some holiday soon so it may be a little while before it lands back on my radar!

@stevejgordon let me know when you can work on this.

Hi @Rick-Anderson! I'd like to get this going. I've just started work on a Pluralsight course about DI in ASP.NET Core so it may be a good time to squeeze in some writing for this.

What are your thoughts on where these sections best fit? Within the existing main document or as a sub-section of more advanced topics?

I'll need to think up a reasonable, relatable, practical example of when one might find themselves wanting to register open generics besides perhaps a generic repository (which I don't use personally).

@stevejgordon Off hand probably new sections, with links to the new sections in the doc where applicable.

@scottaddie - please comment.

@Rick-Anderson The existing doc is already quite long. Adding more sections to it may make DI look more intimidating than it really is. I propose the creation of 3 new docs and the following ToC structure:

  • Dependency injection

    • Overview (link to the existing doc)

    • Register generic types

    • Registering implementations using delegates

    • Register multiple implementations of an interface

Thoughts?

@scottaddie Sounds reasonable. They might not be huge documents if broken up as I don't think a lot of words are needed (not as much as my blog posts) to cover the relevant points. It might be possible to combine the three things into a single doc called "Advanced registration scenarios" or something along those lines?

@stevejgordon I really like your proposal of "Advanced registration scenarios". Let's go with this ToC structure:

  • Dependency injection

    • Overview (link to the existing doc)

    • Advanced registration scenarios (new doc containing a section for each of the 3 topics)

Also, use a single sample app to demonstrate all 3 registration scenarios.

Thanks @scottaddie. I'll try to fit some time in around my course authoring to get an initial PR in. I'll try to get at least an outline in early so we can discuss the content as it moves forward. Does that sound okay?

@stevejgordon That sounds great. Let me know how I can help.

No worries, thanks for your patience. This never quite found it's way up my list of things to do!

@stevejgordon let me know if you're still interested in working on these. We can do all the editing work, you can write with with your favorite editor.

Was this page helpful?
0 / 5 - 0 ratings