Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • In regards to the second paragraph, let's use the example of AutoMapper here, are you saying that services.AddAutoMapper() is an antipattern and we should instead be registering the internal components of the AutoMapper library ourselves? Because that's something I as a developer (a) don't care about and (b) don't want to be tasked with whenever AutoMapper releases an update. And then the same applies to our own dependent projects and plugins: passing the container allows the individual components to register their own private details that others don't necessarily need to know about. Commented Mar 1, 2023 at 0:37
  • that's a bit of a side question, but yes it is an anti pattern. For exactly the reasons you mention. you have hidden all the dependencies config and options in a private methods and only exposed them to your static AddXXX call. breaks the O in solid amongst many other things Commented Mar 1, 2023 at 10:58
  • not sure its relevant here because I think we can generally assume that sevices.AddXXX() and only adding dependencies. whereas in this case we are pulling them Commented Mar 1, 2023 at 10:59