2

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.

  • Yeah this is actually quite complicated, there's no real consensus on the matter. But in theory, most containers work as drop-in replacements. – grokky Mar 10 '17 at 16:56
1

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.