Question

I'm using ASP.NET Core's builtin DI container. It's missing some features I need, so I need to use a third-party container.

The top ones on Nuget are Autofac and StructureMap. SimpleInjector is consistently the fastest, so I'm considering it too.

I have a large code base, so I want to integrate an external container with minimal disruption and refactoring.

Are any of them drop-in replacements for the builtin container?

I'm not asking a subjective, "which is the best" sort of question. I don't really care. I need to know which is the most compatible.

Was it helpful?

Solution

According to this blog post, all that is required for ASP.NET Core to support your chosen DI container is to implement the IServiceProvider interface, using a wrapper around your DI container of choice. You're then free to use whatever additional features your container provides.

OTHER TIPS

I've integrated Autofac into my system, and other than the few lines of config, it works as a drop-in replacement.

Other containers probably work too, but I can only confirm for Autofac.

Licensed under: CC-BY-SA with attribution
scroll top