MEF programming guide blog Summary

Source: Internet
Author: User
Before MEF, many dependency injection frameworks have been proposed to solve application scalability problems, such as OSGI implementation using Spring. On Microsoft's platform,. NET Framework itself contains the component model and System. Addin. There are also several open-source solutions, including the SODA architecture of SharpDevelop and the "control reversal" container (such as Castle Windsor, Structure Map, Spring. Net, and Unity ).

Although various solutions, including MS, have blossomed on the. NET platform, MEF is the first solution released with CLR.

Official statement: Managed Extensibility Framework (MEF) is an extension management Framework on the. NET platform. It is a collection of features, including dependency injection (DI) and Duck Typing. MEF provides developers with a tool that allows us to easily scale applications and minimize the impact on existing code, developers define some extension points based on functional requirements during the development process, and then the extension personnel can use these extension points to interact with the application; at the same time, MEF allows no direct dependency between applications and extensions, which also allows the sharing of extensions among multiple extensions with the same requirements.

 

  FlowersAfter a month or so, we will provide the official MEF Programming Guide (THe MEF Programming Guide) As well as some of your own experience, in order to make it easier for you to read this series of blog posts, a detailed list of the following blog posts.


  MEF programming guide 1: Host MEF in an application

This article describes how to host MEF in an application and how to import, export, and combine components through a simple application example.

 

  MEF Programming Guide 2: Using CompositionInitializer to host MEF in Silverlight

This article describes how to use the CompositionInitializer host MEF in Silverlight, and demonstrates the dynamic loading accessory combination of MEF and some simple application cases through different import and export configurations.

 

  MEF programming guide 3: Basic Application of Composable Parts and Contracts in MEF

This article describes how to define Composable Parts and Contracts, as well as the application of contract-based multi-component components, including multiple implementations of interfaces, how to Use the ImportManyAttribute feature to obtain multiple implementation instances of interfaces through contracts. Finally, it introduces how to assemble components of a specified contract through contract constraints.

 

  MEF programming guide 4: Using MEF to Declare export (Exports) and import (Imports)

This article describes how to use MEF to Declare export (Exports) and import (Imports), including class, field, attribute, and method-level part Export and export applications.

 

  MEF programming guide 5: Lazy loading and exporting parts and Metadata)

This article describes the Lazy mechanism and Metadata export features in MEF.

 

  MEF Program Design Guide 6: DeploymentCatalog in MEF)

MEF provides different directory mechanisms for WPF and Silverlight. The main function of using the directory is to facilitate the loading of program components, as well as the dynamic combination of application components and other functions. It is also very convenient to get assembly, export parts and other related data of program components.

 

  MEF Programming Guide 7: Using Catalog to dynamically load xap and Filtered Catalog)

If you do not use MEF for hosting extension processing, you only need to download and parse the package through WebClient. In fact, the underlying implementation of MEF dynamic download is the same as that of WebClient, which is then dynamically combined using AggregateCatalog.

 

  MEF programming guide 8: Part lifecycle (Parts Lifetime) Hosting

Every exported component in MEF that can be dynamically assembled has a life cycle, and is generally not managed without special requirements, in fact, MEF has performed default lifecycle management for each part. MEF has three lifecycles: Any, Shared, and NonShared, which are defined in System. componentModel. composition. in the CreationPolicy enumeration object.

 

  MEF programming guide 9: Recomposition MEF parts

Based on the previous eight programming guidelines, I believe everyone knows that the combination of application components is assembled during initialization. If the application Initialization is complete and new components are imported and assembled, the current implementation method cannot be used, we need the Recomposition function provided by MEF to dynamically assemble, dynamically combine, and dynamically send notifications of new component assembly combinations) component features can be used.

 

  MEF Official Website:Http://mef.codeplex.com/

 

Description

This document is a learning note and is intended to be shared with people with lofty ideals. You are welcome to repost this article, but mark the original article connection in a prominent position.

Author: Beniao

Article Source: http://beniao.cnblogs.com/or http://www.cnblogs.com/

 

 

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.