DotNetNuke3 Research Report II (data access)

Source: Internet
Author: User
Access | data in order to maintain the universality of DNN data access, DNN3 developers have carefully designed the data calls. Below let us to appreciate DNN excellent data access scheme!
DNN's first database is SQL Server, but it is by no means limited to using SQL Server but applies to all storage scenarios. such as: Oracle,access ... And so on, even can be an XML file or a general text file.
What data access scenario DNN3 uses is determined by the configuration in the web.config.


Data access Scenario Configuration read
<sectiongroup name= "DotNetNuke" >
<section name= "Data" type= "DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/>
</sectionGroup>
This section configuration determines that the configuration of the DNN data access scheme is handled through the DotNetNuke.Framework.Providers.ProviderConfigurationHandler class in the DotNetNuke namespace.

Specific data access scenario configuration parameters
<appSettings>
<add key= "Sitesqlserver" value= "Server=192.168.0.5;database=dnn;uid=sa;pwd=good"/>
</appSettings>
This section configuration adds a appsetings option, which is typically configured as a database connection, where you can change to another name and string value, depending on your needs.

Data access scenario configuration used by the module
In web.config, you will find multiple content similar to the following configuration,
<providers>
<add name= "Dnnsqlroleprovider"
Type= "DotNetNuke.Security.Role.DNNSQLRoleProvider, Dnnsqlroleprovider"
Connectionstringname= "Sitesqlserver"
Applicationname= "/"
Description= "Stores and retrieves roles data from the local Microsoft SQL Server database"/>
</providers>
These configuration sections are DNN used to set up data access scenarios for each module, so we can even set different data access scenarios for each module of DNN, and of course we can use multiple different databases.

Data access scenario configuration used by the system
Here's the most important configuration section.
<dotnetnuke>
<data defaultprovider= "Sqldataprovider" >
<providers>
<clear/>
<add name= "Sqldataprovider"
Type= "DotNetNuke.Data.SqlDataProvider, Dotnetnuke.sqldataprovider"
Connectionstringname= "Sitesqlserver"
Upgradeconnectionstring= ""
Providerpath= "~\providers\dataproviders\sqldataprovider\"
Objectqualifier= ""
databaseowner= "dbo"/>
</providers>
</data>
</dotnetnuke>

This section is where the DNN main program configures the data access scenario, defaultprovider indicates the data access object that should be used by each module within the DNN when there is no special designation. In the <data> section, you can add multiple data access objects.
<clear/> indicates that all data access objects are cleared.
<add > represents adding a data access object.
Type: Indicates the actual class that implements the data access object, and because DNN uses the principle of reflection to create a specific data access object, make sure that the assembly that implements the class is accessible.
Connectstringname: Configure the name of the configuration section for the data connection scheme
Upgradeconnectionstring: The name of the connection configuration section that is used when the database is updated, and if it remains empty, it indicates that the same value is used and connectstringname.
ProviderPath: The location of the assembly that implements the data Access object
Objectqualifier: Used to distinguish the identities of different objects in the database so that the tables and stored procedures that they generate when they contain more than one site are automatically added to the prefix to differentiate them from other sites.
Databaseowner: This is not much to say.



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.