Plug-in system for MONGODB management tools

Source: Internet
Author: User
Tags abstract empty mongodb

The development of MONGODB management tools Mongocola has entered its third year.

The official lack of input to C # has led to a lot of things that have to be done on their own, but in any case, the tools are powerful now.

Recently ready to start the development of plug-in systems, simple plug-in system, in fact, the amount of code is very small.

1. Plug-in base class

The plug-in system requires the support of a plug-in base class, which sets the intrinsic fields that a plug-in contains, such as plug-in name, plug-in description, plugin author, and so on.

At the same time, also defines the main method name, after all, the plug-in system must use reflection to complete, so many things must be unified.

Using System; Namespace Magicmongodbtool.common {Public abstract class Plugbase {///<summary>///path class [
            Considering that possible hierarchies will change later]///</summary> public enum Pathlv:int {///<summary>
            Connection/server///</summary> connectionlv = 0,///<summary>  Specific examples///</summary> Instancelv = 1,///<summary>///
            Database///</summary> Databaselv = 2,///<summary>///Data set
            </summary> COLLECTIONLV = 3,///<summary>///data document </summary> DOCUMENTLV = 4,///<summary>///Miscellaneous///<
    /summary> Misc = 9}///<summary>///plug-in menu representation name///</summary>    public string plugname = String.Empty;
        <summary>///Plug-in features brief///</summary> public string plugfunction = String.Empty;
        <summary>///Processing Object///</summary> public dynamic plugobj;
        <summary>///Object Level///</summary> public pathlv runlv = PATHLV.CONNECTIONLV; <summary>///Run///</summary>///<returns></returns> PU 
    Blic abstract int Run (); }
}

Run is an abstract method, and since it is an abstract method, the plug-in that inherits the class must implement this method. Run is also the entry function for the tool to invoke the plug-in function later.

This base class, can be in the form of source code to add to the project inside the plug-in, of course, can also be made into a DLL, let the plug-in project reference. I now say it's made of a DLL.

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.