Enterprise-level agile software development platform based on DotNet component technology-AgileEAS. NET-plug-in tag implementation

Source: Internet
Author: User
Tags dotnet

In the previous article, the plug-in interface IModule of AgileEAS. NET introduced the basic contract meaning of the plug-in, that is, the interface. This article will provide the definition of another module plug-in, using the property tag plug-in.

We have defined the ModuleAttribute attribute:

ModuleAttribute // <summary> // attributes of the EAS. NET module plug-in. /// </Summary> /// <remarks> // provides the IModule tag implementation and the attribute tag-based plug-in implementation. /// </Remarks> [AttributeUsage (AttributeTargets. class)] public class ModuleAttribute: Attribute {private Guid guid = System. guid. empty; private string name = string. empty; private string description = string. empty; // <summary> // initialize the ModuleAttribute object. /// </Summary> /// <param name = "guid"> module Guid. </Param> /// <param name = "name"> Module name. </Param> public ModuleAttribute (string guid, string name) {this. guid = new Guid (guid); this. name = name ;}/// <summary> // initialize the ModuleAttribute object. /// </Summary> /// <param name = "guid"> module Guid. </Param> /// <param name = "name"> Module name. </Param> /// <param name = "description"> module description. </Param> public ModuleAttribute (string guid, string name, string description) {this. guid = new Guid (guid); this. name = name; this. description = description;} // <summary> // module Guid. /// </Summary> public string Guid {get {return this. guid. toString ();} set {this. guid = new Guid (value) ;}/// <summary> /// Module name. /// </Summary> public string Name {get {return this. name;} set {this. name = value ;}//< summary> /// module description. /// </Summary> public string Description {get {return this. description;} set {this. description = value ;}}

And ModuleRunAttribute attributes

ModuleRunAttribute /// <summary> // module entry method attribute. /// </Summary> /// <remarks> /// use ModuleAttribute to implement the Mark-based IMoule module. /// </Remarks> [AttributeUsage (AttributeTargets. Method)] public class ModuleRunAttribute: Attribute {// <summary> // initialize the ModuleRunAttribute object. /// </Summary> public ModuleRunAttribute (){}}

We only need to mark ModuleAttributes on the class of the module plug-in we want to public, and add ModuleRunAttribute on the module's entry call method. The following is an example:

Hello /// <summary> /// plug-in implemented based on tags. /// </Summary> [Module ("CB58C5BB-5D15-4a17-802E-341F9F65F35C", "Hello example", "tag-based Module implementation example")] public class Hello {// <summary> // entry method. /// </Summary> [ModuleRun] public void Start () {MessageBox. show ("Hello... ");} public void Start2 () {MessageBox. show ("Hello2... ");}}

In the above example, we marked a module plug-in, whose GUID attribute is "CB58C5BB-5D15-4a17-802E-341F9F65F35C", the module name is Hello example, the entry method is the Start method, specifically declare, start must be a public parameter, and the Web module does not need the entry method.

 

Link: AgileEAS. NET application development platform Introduction

Agile parallel development method of AgileEAS. NET

Agile Software Engineering Lab

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.