Link
Operations on the file system:
Currently, files in Built-in 3 Support objects such as XML, text, and config, which are located in the xmlprovider, textprovider, and suitconfigprovider class libraries. You can call them by yourself. Most file operations use static operations.
Operations on the config file:
Here we also introduce the getitem, getsection, appenditem, and removeelement methods in the suitconfigprovider class library. item and node content in config, and add or remove nodes. For example, the following item information is displayed:
<Add key = "nameabc" value = "Data Source = Server IP; user; Password = 111111; Integrated Security = no; enlist = false; pooling = true;"/>
Use the suitconfigprovider. getitem ("nameabc") statement to obtain the item content immediately.
Methods In the suitconfigprovider class are implemented as static and can be called directly. The following table lists the method call instructions:
Method Name |
Description |
Static configfiletype configtype |
Indicates the config type. The default value is web application.Program |
Static string getitem (string key) |
Obtains the value of an "add key" item. |
Static hashtable getsection (string sectionkey) |
Obtain the data of a node and return hashtable |
Static string getconnectionstring (string key) |
Protected internal type, initializing database connection |
Static bool modifyitem (string key, string value) |
Modify the value of an "add key" item |
Static bool appenditem (string key, string value) |
Add the value of an "add key" item |
Static bool removeelement (string key) |
Remove "add key" item |
Operations on text files:
Method Name |
Description |
Static string getcontent (string fileinfo) |
Reload twice to obtain the File Content |
Static bool createfile (string fileinfo) |
Create a file |
Static bool appendfile (string STR, string fileinfo) |
Reload twice to append the File Content |
Operations on XML files:
Method Name |
Description |
Static list |
Reload twice to obtain the file content. The input file is the file path and root node name. Each node information is stored in hashtable and returned in the form of list |
Static bool createfile (string singlenode, string fileinfo) |
Create a file. The input file is the file path and root node name, |
Static bool appendfile (string singlenode, string element, list |
Reload twice to append the file content. The input file is the name in the root node, append node name, Append content structure, and append file information. The structure of the appended content is list |
Support Information of Web. config for dataprovider (select Configuration ):
Key name |
Explanation |
Isline. provider. dataprovider. cfgdllname |
Reflected database factory DLL location |
Isline. Security. configuration. tokenkey |
Seed used for encryption (string) |
Isline. Data. configuration. dbconnectstring |
Database connection information |
Isline. Data. configuration. textproviderfileinfo |
Default file location |
Isline. Data. configuration. sqlserverconnectstring |
SQL database connection information |
Isline. Data. configuration. oracleconnectstring |
Oracle database connection information |
Cache support for isline. Data. containerdefiner namespaces:
Here we will mention the cache support for the containerdefine class in this namespace.
This class implements four interfaces: isqlcontainer, ioraclecontainer, ifilecontainer, and idisposable, including common ADO. NET data objects, such as dataset and reader, can be directly assigned to the corresponding objects in the containerdefine class by using the data objects obtained by oracleprovider or sqleprovider. For example:
// Declare a container
Containerdefine Cd = new containerdefine (cachetype. httpruntime, "islinecache ");
// Assign the returned DataSet object to the CD container
CD. dataset = new oracleprovider (). executedataset (SQL, commandtype. storedprocedure, "testtable", null)
Please note that the constructor has two parameters during CD. The first parameter is to enable httpruntime cache, and the second parameter is the cache name. After the DataSet object in CD is assigned a value, will be automatically cached. The next time you call CD. the DataSet object is automatically read from the cache and does not require oracleprovider (). the executedataset () method is used to retrieve data again. Currently, cache is supported.. Net runtime cache and context cache. Of course, the cache policy is disabled by default. The cache is enabled only when the constructor receives the preceding parameters.
For more information about cache, seeArticle"Isline. httpcontent. httpcontentprovider namespace series"
Dataprovider does not introduce many other content, so we will not describe them one by one here. Maybe aicken will continue to write the complete content later.
Appendix dataprovider database method Daquan:
Method/field name |
Function |
Type |
Executenonquery (string plain text) |
Execute the passed SQL statement |
Static int |
Executenonquery (string cmdtext, string connectionkey) |
Use the specified connection string connectionkey to execute the passed SQL statement. The connectionkey must have a value in the web. config file. |
Static int |
Executenonquery (string parameter text, bool isusingdbtransaction, commandtype parameter type, Params dbparameter [] commandparameters) |
1. isusingdbtransaction indicates whether to use database transactions. 2. If plain type is text, plain text is an SQL statement. If plain type is stored procedure, plain text is the name of the stored procedure. 3. If you do not need the last parameter, pass null. |
Static int |
Executenonquery (string cmdtext, string connectionkey, bool isusingdbtransaction, commandtype cmdtype, Params dbparameter [] commandparameters) |
Use the specified connection string connectionkey. For more information, see method 3. |
Static int |
Executenonquery (string parameter text, dbconnection connection, bool isusingdbtransaction, commandtype parameter type, Params dbparameter [] commandparameters) |
Use the specified dbconnection for execution. For more information, see method 3. |
Static int |
Executescalar (string plain text) |
Execute the passed SQL statement |
Static object |
Executescalar (string parameter text, commandtype parameter type, Params dbparameter [] commandparameters) |
For other instructions, see method 3. |
Static object |
Executescalar (string cmdtext, string connectionkey, commandtype cmdtype, Params dbparameter [] commandparameters) |
Run with the specified dbconnection |
Static object |
Executescalar (string parameter text, dbconnection connection, commandtype parameter type, Params dbparameter [] commandparameters) |
Run with the specified dbconnection |
Static object |
Executereader (string plain text) |
Run the SQL statement and return dbdatareader. Note: after calling this method, you must call dispose () to release resources. |
Dbdatareader |
Executereader (string parameter text, commandtype parameter type, Params dbparameter [] commandparameters) |
For other instructions, see method 3. |
Dbdatareader |
Executereader (string cmdtext, string connectionkey) |
See method 2 |
Dbdatareader |
Executereader (string cmdtext, commandtype cmdtype, string connectionkey, Params dbparameter [] commandparameters) |
For other instructions, see method 3. |
Dbdatareader |
Executereader (string parameter text, commandtype parameter type, dbconnection connection, Params dbparameter [] commandparameters) |
See Method 4. |
Dbdatareader |
Executedataadapter (string plain text) |
Execute SQL statements |
Dbdataadapter |
Executedataadapter (string cmdtext, string connectionkey) |
See method 2 |
Dbdataadapter |
Executedataadapter (string parameter text, commandtype parameter type, Params dbparameter [] commandparameters) |
For other instructions, see method 3. |
Dbdataadapter |
Executedataadapter (string cmdtext, commandtype cmdtype, string connectionkey, Params dbparameter [] commandparameters) |
See Method 4. |
Dbdataadapter |
Executedataadapter (string parameter text, commandtype parameter type, dbconnection connection, Params dbparameter [] commandparameters) |
See Method 4. |
Dbdataadapter |
Executedataset (string plain text) |
Execute SQL statements |
Dataset |
Executedataset (string cmdtext, string connectionkey, int some) |
Use the specified connection string connectionkey. For more information, see method 3. |
Dataset |
Executedataset (string jsontext, commandtype jsontype, string srctable, string connectionkey, Params dbparameter [] commandparameters) |
Srctable is the name of the filled table. For more information, see method 3. |
Dataset |
Executedataset (string plain text, commandtype struct type, string srctable, Params dbparameter [] commandparameters) |
For other instructions, see method 3. |
Dataset |
Executedataset (string plain text, string srctable) |
For other instructions, see method 3. |
Dataset |
Executedataset (string cmdtext, string srctable, string connectionkey) |
For other instructions, see method 3. |
Dataset |
Dispose () |
Release all members in the instance, including various reader, adapter, and connection |
Void |
To be continued
I amAicken)You are welcome to follow my next article.