(3) Design and implementation of the communication mechanism in the MEF plug-in system, and mef plug-in

Source: Internet
Author: User

(3) Design and implementation of the communication mechanism in the MEF plug-in system, and mef plug-in
1. Background

Generally, the C # Event mechanism can be used in WinForm to register and distribute events. However, in the plug-in system, the existing classes cannot be used directly. A plug-in does not contain another plug-in. They are all independently decoupled. To implement communication between the plug-in and plug-in, we also need to design an event engine to fulfill this requirement.

At present, many advanced languages basically implement the observer mode and perform their own packaging. For example, the delegate and event combinations in C #, the Event and addActionListener combinations in java awt, the Event, addEventListener, and dispatchEvent in Flex.

However, to implement the event mechanism of the plug-in system, you need to re-use the observer mode for design. The concept of generics will also be involved.

2. Knowledge preparation 2.1 observer Mode

Here we first provide the UML diagram of the observer mode:

 

The observer mode can be understood as two parts:

(1) Obesrver (observer): Each Observer has its own behavior, but they all inherit from the same base class, this base class defines a behavior trigger method for all inherited observers.

(2) Subject: the trigger is the observer. In Subject, there must be a container to store the observer related to the trigger, because it contains the observer container, therefore, the Subject method provides the registration and cancellation methods. At the same time, there must be a trigger method in the Subject. When this method is called, the container containing the observer will be traversed. The Obeserver class uses the polymorphism feature to implement the unique behavior of each observer.

2.2. Generic

Generics are classes, structures, interfaces, and methods with placeholders (type parameters, these Placeholders are one or more types of placeholders stored or used by classes, structures, interfaces, and methods.

Communication Data in the event mechanism cannot be determined as specific data. In the implementation process, it is replaced by generic data.

3. Take a requirement as a clue

In the project, you must notify the host of the address, name, and type of the processed image after the plug-in completes image processing. Then, the host displays the processed images based on the received messages and data.

4. Complete And customizable Subject section

The UML diagram of the design is as follows:

 

4.1 design a single trigger (Subject)

 

The Code implements the observer container, injection, and release sections.

4.2 design the content to be passed (data)

In my project, you need to notify the host of the address, name, and type of the processed image after the plug-in completes image processing. So I will design the data contained in my event as follows:

 

4.3 ConcreteSubject)

The specific data to be transmitted corresponds to the specific trigger. We can have a variety of events, and each trigger will correspond to an event, so here we need to design multiple trigger subclasses. For the trigger event after the plugin process the image described in 3.1.2, the code for implementation is provided here:

 

4.4 design the Contract (Contract) in MEF)

 

4.5 EventAggregator)

 

The trigger container contains all the triggers and provides the GetEvent method to obtain the specific triggers in the container. The Export label is also provided in the Code to allow other plug-ins and components to be loaded to inject the trigger container into it. To inject a method into a specific event, you only need to use the GetEvent method in the trigger container to obtain the trigger, and then subscribe the method to the trigger.

4.6 Overall Structure

 

5. Design a complete deployable Observer (Observer) Part 5.1 inject the EventAggregator container

 

5.2 register the Observer to the corresponding Subject.

First obtain the ConcreteSubject to be registered, and then inject the Observer into it. The Observer here inherits from the Action.

 

6. Design event triggering Part 6.1 inject the EventAggregator container

EventAggregator needs to be injected to the module where the event is triggered.

 

6.2 Implementation of the trigger mechanism

 

Obtain the ConcreteSubject to be triggered, instantiate the information to be passed, and finally trigger this event (Publish ).

7. Summary

At this point, I have resolved the event mechanism in my MEF plug-in system. In fact, it is the implementation of an observer model, but it is a package based on this model. In the next section, I will mainly explain the process of injecting plug-ins into the host in MEF plug-ins, and the implementation of plug-ins in the host.


Communication Line Design CAD drawing is there any plug-in for the sky and the sky designed for Chamber division?

I don't know much about your field. I used CAD before.
I. automatic tagging of distance from each model has this function 2. cannot understand pole cabling 3. Should there be no dynamic Formulas between data, at least not found at present, try to create a table in EXCEL. Each group is counted as a CAD drawing. If it is not complex

Find a thesis entitled "design of teaching business management information system?

I. Construction Objectives
Build a complete, unified, advanced technology, efficient, stable, secure and reliable Teaching Management Information System Based on Internet/Intranet. This is an advanced computer network system integrating automation and informatization of Educational Administration. It provides high-quality and efficient business management and transaction processing for educational administration departments, A complete and reliable teaching information processing system is established by using safe and reliable modern processing and control technologies to collect and transmit information in a timely, accurate and reliable manner. Implements unified information browsing and Score Management for the academic affairs offices of various schools (departments. It shares basic information with the finance department's student fee system, student management system, and Employment Office's student employment management system. Provide comprehensive and timely information and data to visitors of the Academic Affairs Office through the campus network, such as Course settings, student information query, online course selection, academic certificate of an out-of-school organization, and transcript verification.
The security, stability, and reliability of the system are very important. In the Office of Academic Affairs, each department (including each campus) forms a virtual network, teaching affairs are processed in the virtual network, and the firewall is used to isolate the network from the campus network, defend against malicious attacks from external networks. built systems should be able to avoid data losses caused by software and hardware faults, and ensure the security and confidentiality of data during transmission; the system has enough throughput to avoid system crashes due to too many service requests. It can provide services 24 hours a day and 365 days a year. The interface is friendly and easy to learn, non-computer professionals can master basic operations after a short period of training.
Through the construction of teaching management information system, the quality of teaching management personnel can be improved. Through practical application of teaching management personnel, the teaching management level and efficiency of our school can be improved; by providing multi-level educational administration information services and advanced and practical means of use, it meets the requirements of internal and external schools for educational administration information sharing and utilization, and provides effective decision-making services for leaders at all levels. Ii. Principles of system construction the system is constructed as a resource subnet of the school management information system, which will be based on the campus network to share information resources. At the same time, it establishes an initial framework for the construction of the school information system. 2.1 Overall consideration: the Information Sharing application system is based on the campus network to achieve high-level information resource sharing and cross-platform information resource access, not only to share information resources for different departments in the school, the existing or established information system resources of each department should also be shared, while the system platforms of information systems and resource subsystems of each department are different, and the databases are different, to achieve information sharing between different resource subnets and improve the utilization of information resource sharing, the system structure should have a mechanism for cross-platform access to different data sources. Establishes data interfaces with other systems. educational administration systems can provide data sharing for other systems, such as personnel systems and scientific research systems. 2.2 inclusive and scalable systems should be well scalable and inclusive. System scalability should include accepting existing systems and effectively protecting existing investments in future system software and hardware scaling. Especially when application requirements change (Application and system requirements are often incomplete or often changed), there is a good application platform that can be easily adjusted. The system is easy to expand and upgrade, which not only meets the current business needs, but also leaves space for future expansion. 2.3 standardized educational administration information management the educational administration information is described in a unified data format throughout the school, and the educational administration work such as teaching plans are standardized and standardized. The "basic information set for management of Colleges and Universities" (teaching information [1992] No. 1) (teaching information [1994] No. 1) published by the State Education Commission is the basic information standard. Priorities for adopting information standards are: national standards, Ministry of Education Standards, institution standards of the Ministry of Education, standards issued by other ministries, Shanghai Municipal Education Commission standards, Shanghai local standards, and Shanghai Jiao Tong University standards. 2.4 The system is simple, easy to use, easy to maintain, and applicable to non-computer personnel. The application system is designed to meet the needs of daily office operations. The system features are complete, practical, simple, and easy to learn. The interface is friendly and clear, and easy to expand. The network structure is simple, clear, easy to manage, and easy to expand. 2.5 provide teachers and students with good information services. On the basis of standardized and standardized educational administration information, the information should be reasonably distributed to provide high-quality and efficient business management and transaction processing, this allows all teachers and students to query the teaching plan of this major on any platform, learn about the Course settings, query the scores, and select courses online. Instructors can check the courses ...... remaining full text>
 

Related Article

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.