WEB programming based on unified plug-in interface

xiaoxiao2021-03-06  41

Since I saw some very good code when I was self-study, I found a lot of Java's code, and later downloaded a C # written by C # on Microsoft's website (the specific link must not be passed, will be passed later So, so I have already moved the idea of ​​using the plug-in to develop Web site programs, but I didn't find the relevant article after searching online. I wrote some, published here, I hope everyone will advise. This article basically The design structure is a plug-in mode. For each database table, there is a plugin corresponding to the convenience, but it is true to write it into .CS file format, and declare in the WebConfig configuration file, as follows is the global interface file [ Please forgive my terminology and not standard], file name: iplugstarclub.csusing system; use system.data; using system.data.oledb;

Namespace Clubstar.iplug {///

/// iPlugStarclub's summary description. /// public interface IPlugStarClub {string Name {get;} // the name of the called PLUG, such as a friend or the like user class OleDbDataReader PerformSelect (IPlugSql sql); void PerformDelete (IPlugSql sql); void PerformInsert ( IPLUGSQL SQL); Void PerformUpdate (IPLUGSQL SQL);

} According to the definition requirements of the interface, the following is the name of the IPLUGSQL file file: iplugsql.csusing system;

Namespace ClubStar.iplug {///

/// iPlugsql's summary description. /// public interface iplugsql {string sqlstring {get; set;}}

} The following file is the collection and operation class when the interface file is running [I think this]: [The code here is the code in the software mentioned in the previous, my original reference] File name: Plugincollection.csusing System; using system.collections;

Namespace clubstar.iplug {// this class was generated using cotsmith (http://www.ericjsmith.net/codesmith/) ///

/// represents a collection of iPlugin < / see> Objects. /// public class plugincollection: CollectionBase {/// /// initializes a new instance of the Plugincollection class. // / public PluginCollection () {} /// /// Initializes a new instance of the PluginCollection class containing the elements of the specified source collection. / // /// A PluginCollection with which to initialize the collection. public PluginCollection (PluginCollection value) {this .AddRange (value);} /// /// Initializes a new instance of the PluginCollection class containing the specified array of IPlugin Objects. /// /// an array of iPlugin Objects with which to initialize the collection. public PluginCollection (IPlugStarClub [] value) {this.AddRange (value);} /// /// Gets the PluginCollection at the specified index in the collection //. / /// in C #, this property is the indexer for the

Plugincollection> Plugincollection class. /// /// public iplugstarclub this [int index] {get {return ((iPlugStarclub) (this.lust [index]);} PUBLIC INT Add (iplugstarclub value) {return this.list.add (value);} ///

/// copies the elements of the specified iPlugin array to The end of the collection. /// /// an array of type iPlugin containing the objects to add to the collection. public void addrange (iPlugStarclub [] value) {for (INT i = 0; (i /////////// "plugincollection"> Plugincollection to the end of the collection. /// /// A Plugincollection Containing the Objects to add to the collection. public void addrange (plugincollection value) { For (INT i = 0; (i //// gets a value indicating whether the collection contains the specified PluginCollection . /// /// The Plugincollection to search for in the collection. /// true

If The Collection Contains The Specified Object; OtherWise, False . Public Bool Contains (iPlugStarclub Value) {Return this.list.contains (value);} ///

// / COPIES The Collection Objects to a One-Dimensional Array Instance Beginning At the specified index. /// /// " T: system.Array "> array That is the destination of the value content from the collection. /// The index of the array at which to begin inserting. public void copyto (iPlugStarclub [] array, int index) {this.list.copy (array, index);} /// /// Creates A One-Dimensional array instance containing the collection items. /// /// array of type iplugin public iPlugStarClub [] ToArray () {iplugstarclub [] array = new iplugstarclub [this.count]; this.copyto (array, 0); return Array;} /// /// Gets the index in the collection of the specified plugincollection , if it exissrs in the collection. /// / // The Plugincollection instance. /// /// An PluginCollectionEnumerator for the PluginCollection instance public new PluginCollectionEnumerator GetEnumerator () {return new PluginCollectionEnumerator (this).; .} /// /// Supports a simple iteration over a PluginCollection /// public class PluginCollectionEnumerator: IEnumerator {private IEnumerator _enumerator; private IEnumerable _temp ; /// /// Initializes a new instance of the PluginCollectionEnumerator class referencing the specified PluginCollection object. /// /// The PluginCollection to enumerate public PluginCollectionEnumerator (PluginCollection mappings). {_temp = ((IEnumerable) (mappings)); _enumerator = _temp.GetEnumerator ();} ///

转载请注明原文地址:https://www.9cbs.com/read-82638.html

New Post(0)