c# - Do DI Containers need to instantiate the object themselves in order to use constructor injection? -
Or instead of making the object itself, they somehow hook into blocking or Em> Object creation (for example, immediately by a controller MVC framework) and pass all the dependencies they need? I realize that in order to use Constructor injection, they need do something to create an object, but I'm not clear about what Whether or not the containers need to be made I realize that this question is probably familiar with tools like structurmaps, which do this to all the DI containers? Unity, Ninja, etc. ... but I am new to them and realized that I really do not know how they work under cover. I have dominated the Internet and I could not find any good answer. I have used all the di IoC containers, the containers themselves work to make you Wherever you do are clearly in test for No output code will be found by using> new something (Dependance 1, Dependance 2) ... instead, you must include the code as "explicitly" or "code" something
( Maybe in the form of dependence of something else) the container reuses an example of either
some , how it is configured (and The
by a has been annotated).
some to call Constructor, at which point the container can not be present at all - Or you might have a test-specific configuration that allows you to ask some dependencies in the way of the stock, and perhaps to provide other dependencies in a test-specific way. (In some cases, you will not need to call the constructor explicitly right now ... if you have a test configuration for the container, for example everything for fake storage If you use it, you may still need to ask for an example of
some to use it in your tests.)
Comments
Post a Comment