Isline Framework series five--dataprovider data access (medium)

Source: Internet
Author: User

Take the above

Before using Dataprovider, you need to configure the following nodes in Web.config to add between <configSections></configSections>:

<IsLine.Data.Configuration>
      <DataBaseConnection>
         <DBType>IsLine.Data.DataTypeEnum.DataBaseType.SqlServer</DBType>
         <Server>Server IP</Server>
         <UserID>sa</UserID>
         <PwdType>Cryptography.Decrypting</PwdType>  // or <PwdType>Cryptography.StrengthDecrypting</PwdType> or <PwdType>Cryptography.None</PwdType>
         <Pwd>111111</Pwd>
         <DataBase>UML</DataBase> //SqlServer only
      </DataBaseConnection>
</IsLine.Data.Configuration>

Where databaseconnection indicates the type of the database, Pwdtype indicates the password encryption policy, Isline provider a built-in 3 policy to choose from, as shown in the configuration file. The example above is for SQL Server, and the following is the Oralce node configuration method:

<IsLine.Data.Configuration>
      <DataBaseConnection>
         <DBType>IsLine.Data.Configuration.OracleConnectString</DBType>
         <Server>TNS别名</Server>
         <UserID>sa</UserID>
         <PwdType>Cryptography.Decrypting</PwdType>  // or <PwdType>Cryptography.StrengthDecrypting</PwdType> or <PwdType>Cryptography.None</PwdType>
         <Pwd>111111</Pwd>
         <OtherPlus>Provider=MSDAORA.1; Persist Security Info=False;</OtherPlus>  //Oracle Only
      </DataBaseConnection>
    </IsLine.Data.Configuration>

Or you can use the following simple configuration method to remove the problem of node configuration:

Sql server:

<add key= "IsLine.Data.Configuration.SqlServerConnectString" value= "Data source=server IP; User; Password=111111;integrated Security=no; Enlist=false; pooling=true; "/>

ORACLE:

<add key= "IsLine.Data.Configuration.OracleConnectString" value= "Data Source=tns alias; User; Password=111111;integrated Security=no; Enlist=false; pooling=true; "/>

After the node is configured, use the following method call, the call time for connection-oriented and connectionless two ways, connection-oriented operations (such as return dataset/reader/adapter, etc.) must be instantiated before use, must be invoked after use. The Dispost () method frees the resource, Dispost () is a Dataprovider overridden method that, once invoked, releases all resources, including connection, Command, DataReader, and so on, and calls directly on the connectionless operation. If you use DataReader, adapter, and so on for connection-oriented operations, simply execute SQL statements for connectionless operations, such as accessing a database for simple execution by using SQL statements:

Oracleprovider.executenonquery ();

Or

Sqlprovider.executenonquery ();

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.