MVC–Unity–challenge answer


The answer (or better yet, my answer):


The proof:




This is leveraging the use of a name when registering a type and using the convention of using the same name for all types in the same context (“A” and “B” in my little sample). Thanks Chris for the suggestion to use this feature.

I’ve done this in code, but Unity works with config files too. I haven’t done i t though.

Happy injection!

Skip to main content