Insert static factory dependency, right or wrong?

I hit a brick wall just recently when I shot Ninject on a project that I'm working on.

I looked at all the issues systematically requesting my design and architecture in favor of dependency injection.

After hours, hours, and hours of searching, I stumbled upon this article by Justin Etagger, which talks about his static DIFactory class.

Now I wonder if something like magic is working using a static DI factory?

I would like to hear the pros and cons of using a static DI factory in a real application.

In addition, IoC and DI too, or are they very similar, although there are some differences?

+6
source share
1 answer

A static DI Factory is a service locator and a service locator is an anti-pattern because it will be difficult to explain your code :

The only advantage of Service Locator is that it is a little easier to understand than dependency injection . However, DI is not so difficult to understand once you overcome a few conceptual obstacles .

The connection between IoC and DI is that DI is a special case of IoC .

+7
source

All Articles