Read more IOC, read more about dip, IOC, Di, and IOC containers.

Source: Internet
Author: User

IOC isSoftware Design ModelIt tells you how to do this to remove the coupling between mutually dependent modules.Control inversion (IOC), which provides abstraction for mutually dependent components and transfers the acquisition of dependent (low-level module) objects to a third party (system) for control.,That is, the dependent object is not directly obtained through new in the dependent module class..The dependency inversion principle converts dependencies. The high-level module does not depend on the implementation of the lower-level module, and the lower-level module depends on the interfaces defined by the high-level module.. In layman's terms, the high-level module defines the interface, and the lower-level module is responsible for implementation. IOC is an important method,It is to transfer the creation and binding of dependent objects to the external of the dependent object class for implementation.. Dependency injection (DI ),It provides a mechanism to pass the reference of the dependent (low-level module) object to the dependent (high-level module) object.

From http://www.cnblogs.com/liuhaorain/p/3747470.html

The interception of this paragraph is very incisive. Currently available IOC containers in. Net: castlewindsor, MEF, and unity. Generally, they have the same functions. Instead, they use code, attribute, or configuration files to pair interfaces with implementations and put them into containers to map dependencies and manage object creation and lifecycle, then, the system or manual interface is used to obtain the corresponding implementation class.

MEF mentioned in the previous article is a little stubborn as an IOC container. Its main function is to use it for application expansion to avoid generating vulnerable hard dependencies, I personally think that MEF is an IOC framework that basically realizes IOC. As an IOC MEF, it may only act as an object factory and provide the ability to manage the object lifecycle and cache. The biggest benefit of MEF is that, if you do not have a high demand for IOC, MEF provides. net Framework-level IOC, you do not need to introduce any additional things.

Can we use MEF completely as IOC? Personal Opinion: as the name suggests, MEF (managed extensibility framework) is created to simplify the creation of scalable applications. Therefore, it is mainly used to have a combination of capabilities between applications. Therefore, it focuses on scalable support, emphasizing combination rather than dependency injection. Is it true that we use MEF for IOC? It is strange.

So, the question is, how to understand MEF and IOC. Follow-up Study!

 

Read more IOC, read more about dip, IOC, Di, and IOC containers.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.