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.