DI Containers Documentation Question

37 views
Skip to first unread message

Derek Greer

unread,
Sep 23, 2020, 2:49:25 PM9/23/20
to masstransit-discuss
I just read over the docs on Containers and saw this blurb at the top:

"MassTransit supports several dependency injection containers. And since Microsoft introduced its own container, it has become the most commonly used container."


I found this a bit surprising.  I do see how this would be true purely from a dependency standpoint given the fact that ASP.Net Core MVC applications have a dependency upon the container introduced with ASP.Net Core, but it would be surprising to learn that most teams actually choose to use Microsoft's container for their own DI registration needs aside from the usage patterns required by virtue of using the framework.  

I'm curious if this is all you meant (i.e. it's the most used, but not necessary the most popular).  For example, every .Net Core application I've written since the beta was introduced has used Autofac.  I'm sure every .Net Core application written by Jeremy Miller since that time has used StructureMap.  Between the two of us, the Microsoft DI Container is the most "used", but the least favored.   If this isn't what was meant, I'm curious where you obtained the stats on this.

Derek




Chris Patterson

unread,
Sep 23, 2020, 3:09:42 PM9/23/20
to masstrans...@googlegroups.com
Just look at the metrics on NuGet, they don't lie. I meet developers every day that have never even heard of Autofac, let alone StructureMap or Castle Windsor.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/a64894cb-072d-466b-be74-91276ea829e3n%40googlegroups.com.

ttt

unread,
Sep 23, 2020, 6:59:54 PM9/23/20
to masstrans...@googlegroups.com
The same feeling here. I am a big fan of Simple Injector but in my team all the new developers are using MS DI. 

Derek Greer

unread,
Sep 24, 2020, 6:43:29 AM9/24/20
to masstransit-discuss
Well, keep in mind that every ASP.Net Core project requires Microsoft.Extensions.DependencyInjection, whether teams are using DI for their own code or not and whether they've chosen to use another container or not.  

The NuGet download stats don't lie ... the package is definitely getting downloaded more than any other container dependency, but that's because it's part and parcel of MVC.  I don't think those numbers can in any way be relied upon to indicate the majority of teams are turning to the Microsoft DI container en masse.  My suspicion is that, while some teams may have started to use the built-in container, the vast majority of teams still turn to full-featured containers like Autofac, StructureMap, Lamar, etc.

Chris Patterson

unread,
Sep 24, 2020, 9:44:41 AM9/24/20
to masstrans...@googlegroups.com
It's hard to know for sure, but the sampling of requests and questions related to MassTransit, most are using MS DI.

I get an Autofac question now and then, and a majority of those developers are still using the full framework on Windows.

I rarely get a Windsor question, and almost never get questions for any of the other v7 supported containers.

César Demicheli

unread,
Sep 24, 2020, 10:18:41 AM9/24/20
to masstrans...@googlegroups.com
I use SimpleInjector as well, but only for full framework services while using Topshelf.
However, when I have to work on ASP.NET Core, I never need anything from any of the third party containers so I stick around with the built-in container.

Reply all
Reply to author
Forward
0 new messages