Refactoring Notes---MEF framework (bottom)

Source: Internet
Author: User

Overview

The previous article introduced a very simple and basic application of MEF, implemented the MEF framework and demonstrated some of the basic requirements and settings of the MEF framework, which are important, and then we analyze how to extend or enhance the MEF framework content.

Enhanced Contract Class Library

In fact, with the introduction of the previous article, readers will soon find that the Contract class library is very restrictive, or "it" Only refers to the common class library of the system.xxx type that comes with Windows, and often in the protocol we refer to the methods and members in our actual project engineering, which leads to the reliance on a non-system public class library, such as PRACTISE_MEF. Core. Can that still be achieved, my plugin just generates a "Class library DLL"?

First, let's look at the dependency plot:

All project projects here will depend on the core, where PRACTISE_MEF and practise_mef.contract are direct references (Copy Local = True), PRACTISE_MEF. Plugin.multicalculateex is an indirect reference (Copy Local = False), here Calculateex the project does not reference the core, and if the reference is an indirect reference. The extension library will not produce or copy Core.DLL after an indirect reference, but rather rely on the host (generally referred to as the UI class library that calls the Extension class library, here is PRACTISE_MEF), so that the plug-in class library will only produce its own class library DLL without producing a referenced DLL, at least it looks neat.

Project Refactoring

With these technical mats, we provide a bright path to refactoring software for the MEF architecture. However, the road is always tortuous.

First of all, since the framework is based on protocol, it is important to analyze what public properties and methods are in the project to be refactored to extract the interfaces, which is of paramount importance, if there is no commonality, the meaning of refactoring itself is not very large.

In the process of collating and extracting the core class library of the project, I think a few aspects deserve to be put forward in the core:

    1. BaseForm
    2. Foundation of the Module/entity/objects
    3. Interface interface
    4. Enum enum
    5. Commissioned delegate
    6. Tool Class Utility
    7. Basic Method Fucntion

。。。

Other, business logic, non-basic methods are extracted to the BLL and other upper modules.

Docker framework

Under WinForm recommended Weifenluo DockPanel plug-in, this plug-in is easy to implement, powerful, you can add the plugin form as a subset of Docker, layout similar to the Visual Studio Editor.

Introduction Weifenluo:

Http://www.cnblogs.com/wuhuacong/archive/2009/07/09/1520082.html

Summarize

With the accumulation of the above three aspects, it is possible to refactor into a MEF plugin framework.

Because this project is still in the open, so the relevant code should not be disclosed.

Refactoring Notes---MEF framework (bottom)

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.