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. /// summary> 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. /// summary> 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. /// summary> public class plugincollection: CollectionBase {/// /// initializes a new instance of the Plugincollection see> class. // / summary> public PluginCollection () {} /// /// Initializes a new instance of the PluginCollection see> class containing the elements of the specified source collection. / // summary> /// A PluginCollection see> with which to initialize the collection. param> public PluginCollection (PluginCollection value) {this .AddRange (value);} /// /// Initializes a new instance of the PluginCollection see> class containing the specified array of IPlugin see > Objects. /// summary> /// an array of iPlugin see> Objects with which to initialize the collection. param> public PluginCollection (IPlugStarClub [] value) {this.AddRange (value);} /// /// Gets the PluginCollection see> at the specified index in the collection //. / /// in C #, this property is the indexer for the
Plugincollection> Plugincollection see> class. /// para> /// summary> 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 see> array to The end of the collection. /// summary> /// an array of type iPlugin see> containing the objects to add to the collection. param> public void addrange (iPlugStarclub [] value) {for (INT i = 0; (i /////////// "plugincollection"> Plugincollection see> to the end of the collection. /// summary> /// A Plugincollection see> Containing the Objects to add to the collection. Param> public void addrange (plugincollection value) { For (INT i = 0; (i //// gets a value indicating whether the collection contains the specified PluginCollection see>. /// summary> /// The Plugincollection see> to search for in the collection. Param> /// true b>
If The Collection Contains The Specified Object; OtherWise, False b>. RETURns> Public Bool Contains (iPlugStarclub Value) {Return this.list.contains (value);} /// // / COPIES The Collection Objects to a One-Dimensional Array See> Instance Beginning At the specified index. /// summary> /// " T: system.Array "> array see> That is the destination of the value content from the collection. Param> /// The index of the array at which to begin inserting. Param> public void copyto (iPlugStarclub [] array, int index) {this.list.copy (array, index);} /// /// Creates A One-Dimensional array see> instance containing the collection items. /// summary> /// array of type iplugin returns> 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 see>, if it exissrs in the collection. /// summary> / // The Plugincollection see> instance. /// summary> /// An PluginCollectionEnumerator see> for the PluginCollection see> instance returns> public new PluginCollectionEnumerator GetEnumerator () {return new PluginCollectionEnumerator (this).; .} /// /// Supports a simple iteration over a PluginCollection see> /// summary> public class PluginCollectionEnumerator: IEnumerator {private IEnumerator _enumerator; private IEnumerable _temp ; /// /// Initializes a new instance of the PluginCollectionEnumerator see> class referencing the specified PluginCollection see> object. /// summary> /// The PluginCollection see> to enumerate param> public PluginCollectionEnumerator (PluginCollection mappings). {_temp = ((IEnumerable) (mappings)); _enumerator = _temp.GetEnumerator ();} ///