Create a database installation and uninstallation script for the dnn Module

Source: Internet
Author: User
Tags dnn

1. Data Tables and stored procedures are completed after the module is developed.
Note: When writing a stored procedure, add "DBO." before the table name and stored procedure name .". (Otherwise, the workload may be increased later)
2. generate an SQL script for related objects in the SQL Server Enterprise Manager.
3. Create a version. sqldataprovider File
A. Copy the generated database tables, stored procedures, functions, and other scripts to a file.
B. Replace
Replace "[DBO]. [" with "{databaseowner} [{objectqualifier }"
Replace "DBO." with "{databaseowner} {objectqualifier }"
Replace "FK _" with "FK _ {objectqualifier }"
Replace "pK _" with "PK {objectqualifier }_"
Replace "DF _" with "DF {objectqualifier} _" ("DF _" is used to add the default value)
C. Remove
Removing the script is similar:
Set quoted_identifier off
Go
Set ansi_nulls on
Go
And
Set quoted_identifier on
Go
Set ansi_nulls on
Go
D. Note:

A noteworthy problem:
The SQL Server database installation/uninstallation script is executed through the executescript method in the sqldataprovider class. This method contains the following sentence: "dim delimiter as string =" go "& controlchars. CRLF ", that is, to separate each SQL statement that can be executed in an SQL script using the" go + carriage return linefeed. Use split to separate each statement into an array and execute each SQL statement cyclically. In this way, when writing the database installation/uninstall script, you must note that the "go + carriage return" line break is added to the end of each statement, especially the "carriage return line break" in the last sentence. Otherwise, either the last sentence cannot be executed or an error is reported.

There is another noteworthy problem:
The script file for database installation/uninstallation must be saved in UTF-8 format; otherwise, an error may occur.

4. Create unstall. sqldataprovider
A. generate an SQL script by using the removal function of the table, stored procedure, and table link in the query analyzer.
B. Repeat the above preparation steps
5. Create a private assembly in the dnn module definition to generate the module installation package.

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.