dependency injection - Ioc/DI - Why do I have to reference all layers/assemblies in entry application? -


(related to this question).

I'm new to D. So bear with me .. I think that the container is in charge of making all my registered types instantaneously, but to do so, my solution and all of them References of DLL are required.

If I use the TD container, I will not have to mention the EntityFramework library in my MVC3 app, only my business layer which will reference my DAL / repo layer.

I know that at the end of the day all the DLLs are included in the bin folder but my problem is VS. In the context of "Add Reference" is to be explicitly referenced so that one can publish all the necessary files .... "

If I was not using the container, then I do not have to refer to the Entiteworkwork Library in my MVC 3 app, only my business layer that refers to my DAL / repo layer.

Yes, this situation is very difficult to avoid De :)

With tightly coupled codes, each library can have only a few references, but They again get other references, such as creating a deeper graph of dependence:

deep Graph

Because the dependency graph is deep, that means drag most of the library with many other dependencies - like in the diagram Library C is dragged along with Library H, Library E, Library J, Library M, Library and Library N . For example, it makes every library difficult to reuse freely from the rest. for example.

However, in a brief coupled application, by moving all the references, the dependency graph is severely flattened :

As color is illustrated with green, now without dragging any unwanted dependencies Library C is possible to reuse

However, everyone has said that, with many di containers, you not to add difficult references to all the necessary libraries instead, you late binding , either as conference-based assembly-scanning (favorites) or XML configurations.

When you do this, you should remember that the assemblies should be copied to the app's bin folder, because now it does not happen automatically, personally, I rarely deserve this extra effort See you here.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -