Here is the original program file actually call using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web. UI.WebControls; using System.Web.UI.HtmlControls; using System.Text; using clubstar.IPlug; using clubstar.IPlug.DataOp; using clubstar.uc; using clubstar.DataOp; namespace clubstar {///
Private void Page_load (Object Sender, System.Eventargs E) {Common Dai = New Common (); // session ("verify") = rNDnum //Response.write (sessionid.text.toString ()); this.button1. Click = new system.eventhandler (onpluginclick);
Public Delegate Void PerformInsert (String Plugname, StringBuilder SQL);
private void OnPluginClick (object sender, EventArgs args) {StringBuilder sql = new StringBuilder (); sql.Append ( "insert into clubuser (ID, sessionID, username) values (2, '123123', 'fuck')"); Common INSERTUSER = New Common (); PerformInsert INSERT = New PerformInsert (INSERTUSER.PERFORMINSERT); INSERT ("Clubstar.iplug.Dataop.user", SQL); // Method for calling the plugin agent}
#Region Web Form Designer Generated Code Override Protected Void OnNit (Eventargs E) {// // Codegen: This call is required for the ASP.NET Web Form Designer. // InitializeComponent (); base.onit (e);} ///
Private void button2_click (object sender, system.eventargs e) {}
}} And the PerformInsert agent in the above file is operated for the following event functions; use system.configuration; use ipstar.IPLUG; use system.text; using system.data.oledb;
A summary description of Namespace Clubstar {///
private PluginCollection m_plugins = null; // called back to the plug-inserting operation public void PerformInsert (string plugname, StringBuilder sql) // insertion operation {m_plugins = (PluginCollection) ConfigurationSettings.GetConfig ( "IPlugs"); PlugSqlOp context = New plugsqlop (SQL.TOString ()); Foreach (iPlugStarclub plugin in m_plugins) {if (plugin.name == plugname) {plugin.performInsert (context); return;}}}
public void PerformDelete (string plugname, StringBuilder sql) // delete operation {m_plugins = (PluginCollection) ConfigurationSettings.GetConfig ( "IPlugs"); PlugSqlOp context = new PlugSqlOp (sql.ToString ()); foreach (IPlugStarClub plugin in m_plugins) {If (plugin.name == plugname) {plugin.performDelete (context); return;}}}
public void PerformUpdate (string plugname, StringBuilder sql) // update operation {m_plugins = (PluginCollection) ConfigurationSettings.GetConfig ( "IPlugs"); PlugSqlOp context = new PlugSqlOp (sql.ToString ()); foreach (IPlugStarClub plugin in m_plugins) {if (plugin.Name == plugname) {plugin.PerformUpdate (context); return;}}} private OleDbDataReader dr; public OleDbDataReader PerformSelect (string plugname, StringBuilder sql) // make queries {// OleDbDataReader dr = new OleDbDataReader (); m_plugins = (PluginCollection) ConfigurationSettings.GetConfig ( "IPlugs"); PlugSqlOp context = new PlugSqlOp (sql.ToString ()); foreach (IPlugStarClub plugin in m_plugins) {if (plugin.Name == plugname) {dr = PLUGIN.PERFORMSELECT (CONTEXT); RETURN DR;}} RETURN DR;} // How to use the above function: first generate the following agent in front file: // public delegate Void PerformInsert (String plugname, StringBuilder SQL); // public Delegate void PerformDelete (String Plugname, StringBuilder SQL); // Public Delegate OleDbDataReader PerformSelect (string plugname, StringBuilder sql); // public delegate void PerformUpdate (string plugname, StringBuilder sql); / * insert sample StringBuilder sql = new StringBuilder (); sql.Append ( "insert into clubuser (ID, sessionID, username VALUES (2, '123123', 'fuck') "); Common INSERTUSER = New Common (); PerformInsert INSERT = New PerformInsert (INSERTUSER.PERFORMINSERT); INSERT (" Clubstar.iplug.Dataop.user ", SQL); // Method for calling the plugin proxy * /
/ * Remove exemplary StringBuilder sql = new StringBuilder (); sql.Append ( "delete from clubuser where ID = 2"); Common DeleteUser = new Common (); PerformDelete Delete = new PerformDelete (DeleteUser.PerformDelete); Delete ( "clubstar .IPLUG.DATAOP.USER ", SQL); // Method for calling the plug-in agent * / / * Query example stringbuilder sql = new stringbuilder (); SQL.Append (" SELECT * from clubuser where id = 2); Common Selectuser = new common (); performselect select = new performselect (selectuser.performselect); DR = SELECT ("ClubStar.iplug.Dataop.user", SQL); // Call the plugin agent method DO {response.write (DR) [ "username"] ToString () "
");. Response.Write (. dr [ "nickname"] ToString () "
");} while (dr.Read () ); // * * update exemplary StringBuilder sql = new StringBuilder (); sql.Append ( "update clubuser set ID = 3 where ID = 2"); Common UpdateUser = new Common (); PerformUpdate update = new PerformUpdate (UpdateUser. PerformUpdate; Update ("Clubstar.iplug.Dataop.user", SQL); // Method for calling the plugin agent * /
}} Finally, only information written in the plugin in WebConfig can call the plugin written: XML Version = "1.0" encoding = "UTF-8"?>