Multi-layer system framework
For more information about the intermediate layer, see handouts.
Http://www.cnblogs.com/dksoft/category/10146.html
Topic: section 1 of the <plug-in type> intermediate layer framework
Topic: section 2 of the <plug-in type> intermediate layer framework | DLL exception how do you handle it? | How to handle exceptions thrown by interfaces in different hosts?
For the client framework solution, refer
Exe bpl dll Interface package solution
Http://www.2ccc.com/article.asp? ArticleID = 1903
Plug-in framework
Overview
To understand the low maintenance cost and development cost, write this framework repeatedly. It can be divided into intermediate layer framework, client layer framework, and plug-in compiling modules.
A framework is a platform. With this platform, each module is available. The platform is the prerequisite for the module operation, therefore, each module must comply with the rules of the platform before it can operate better. The system framework is to implement this function.
Intermediate layer framework
The main framework of the intermediate layer provides services to the client using an EXE application, and each business module provides services to the intermediate layer in the form of DLL.
<Figure 1> intermediate layer framework
Intermediate layer interface
The intermediate layer framework provides an interface (iframeworkservice) for various business modules.
Iframeworkservice = interface // interface provided by the Framework
Function getframeworkinfo (actionindex: integer; var data, MSG: olevariant): hresult;
End;
Module Interface
The business module must provide two interfaces for the intermediate layer to obtain information and perform business logic processing.
Imodelinfo = interface // basic information interface of the module
Procedure getmodelinfo (VAR modelinfo: olevariant); stdcall;
End;
(Modelinfo: olevariant) the following information must be saved so that the module administrator can obtain the information.
Procedure tmodelinfo. getmodelinfo (VAR modelinfo: olevariant );
VaR
Hash: tdkhashtools;
Begin
Hash: = tdkhashtools. Create ();
Hash ['name']: = 'System module ';
Hash ['code']: = 'systemmgr ';
Hash ['version']: = 1.01;
Hash ['grammer ']: = 'yang maofeng ';
Hash ['createdate']: =' 2004-11-12 ';
Hash ['modifydate']: =' 2004-11-12 ';
Hash ['note']: = '';
Hash. saverelevariant (modelinfo );
Hash. Free;
End;
Imodelservice = interface // module operation interface
Function opeartor (actionindex: integer; var data, MSG: olevariant): hresult; stdcall;
End;
Module Output Functions
Each module (DLL) must output three functions
Exports
Getmodelinfo, getmodelservice, setframeworkservice;
Below is the prototype of the three functions
Function getmodelinfo: imodelinfo; // interface for obtaining module information
Function getmodelservice: imodelservice; // gets the module service interface.
Function setframeworkservice (aframeworkservice:
Iframeworkservice): hresult; // imports the Framework service interface to the module.