The connection between codesmith and the database. In codesmith, a self-contained Assembly schemaexplorer. dll is included. Classes in this Assembly are mainly used to obtain the structures of various objects in the database.
<% @ Property name = "sourcetable" type = "schemaexplorer. tableschema" default = "" Optional = "false" Category = "context" Description = "source table name" %>
<% @ Property name = "sourcedb" type = "schemaexplorer. databaseschema "default =" "Optional =" false "Category =" context "Description =" "onchanged =" "editor =" "editorbase =" "serializer =" %>
<% @ Assembly name = "schemaexplorer" %>
<% @ Import namespace = "schemaexplorer" %>
Structures and functions of main classes in schemaexplorer:
Databaseschema
Owner *:
Connectionstring: Generally, enter a connection string similar to ADO. net.
Name: Database Name
Provider: The driver provider. It is generally instantiated as a sqlschemaprovider object.
Set:
Commands: a collection of all stored procedures
Tables: a set of all tables
Views: a set of all views
Tableschema
Owner *:
Name: Table Name
Database: Database
Datacreated: date of creation
Fullname: Full name
Hasprimarykey: whether a primary key exists
Owner: Owner
Primarykey: primary key information
Method: gettabledata: get all the data in the table. The result is datatable.
Set:
Columns: All column Sets
Foreignkeycolumns: a set of all foreign key columns
Foreignkeys: a set of foreign key information
Indexes: the combination of all indexes
Keys: a set of all primary key and foreign key columns
Nonkeycolumns: a set of all non-primary key foreign key columns
Nonforeignkeycolumns: a set of all non-foreign key columns
Nonprimarykeycolumns: a set of all non-primary key columns.
Primarykeys: a set of primary key information
Commandschema Stored Procedure Structure
Owner *:
Name: name of the stored procedure
Fullname: Full name
Database: Database
Datacreated: date of creation
Owner: Owner
Returnvalueparameter: Return Value parameter, which does not appear to be available in sqlserver
Commandtext: source code of Stored Procedure content
Set:
Allinputparameters: a set of all input parameters, which may include parameters that are both input and output.
Alloutputparameters: a set of all output parameters, which may include parameters that are both input and output.
Commandresults: a set of query results for Stored Procedures
Inputoutputparameters: Set of Input and Output Parameters
Inputparameters: a set of all input parameters
Outputparameters: a set of all output parameters
Parameters: a set of all parameters
Nonreturnvalueparameters: set of parameters other than return values
Viewschema View Structure
Owner *:
Name: View name
Fullname: view full name
Database: Database
Datacreated: date of creation
Owner: Owner
Viewtext: view source code
Method: getviewdata: Get the data in the view. The return type is datatable.
Set: columns: Set of all columns in the view
Columnschema Column Structure
Owner *:
Name: column name
Nondbnull: whether to allow null
Database: Database
Datatype: Internal data type
Isforeignkeymember: whether it is a foreign key
Isprimarykeymember: whether it is a primary key.
Isunique: unique or not
Nativetype: Data Type in the database
Precision: Precision
Scale: number of decimal places
Size: Column Length
Systemtype: Type of the current column in the language used
Table: Table
Parameterschema parameter structure
Owner *:
Name: Parameter Name
Nondbnull: NULL
Command: name of the stored procedure
Database: Database
Direction: parameter type: input, output, input and output, Return Value
Nativetype: Data Type in the database
Size: Length
Precision: Precision
Scale: number of decimal places
Systemtype: Type of the current column in the language used
Structure of viewcolumnschema view Columns
Owner *:
Name: View name
Nondbnull: NULL
View: View
Database: Database
Nativetype: Type in sqlserver
Size: Length
Precision: Precision
Scale: number of decimal places
Systemtype: Type of the current column in the language used
Table keyschema
Owner *:
Name: name of the table key, that is, the constraint name.
Database: Database
Foreignkeytable: a table with a foreign key, that is, a subtable.
Primarykeytable: primary key table, that is, the primary table
Primarykey: primary key information of the primary table
Set:
Primarykeymembercolumns: set of primary key member columns in the current key information, that is, the set of primary key columns in the main table
Foreignkeymembercolumns: The member column set of the current foreign key information, that is, the column set of a foreign key in the subtable.
Indexschema Index Structure
Owner *:
Name: Index name
Table: Table
Database: Database
Is: whether to clustered Index
Isprimarykey: whether it is a primary key index
Isunique: whether it is a unique index
Set: membercolumns: Index column set
Extendedproperty Extension Information
Table:
Cs_isidentity: whether it is an identifier. Access is not supported.
Cs_iscomputed: whether it is a computed Column
Cs_isdeterministic: Are you sure you want...
Cs_identityseed: Number of seeds in the identification Column
Cs_identityincrement: Number of ID column increments
Cs_default: column Default Value
Cs_isrowguidcol
View:
Cs_iscomputed: whether it is a computed Column
Cs_isdeterministic:
Command:
Cs_default: the default parameter of the stored procedure.