Codesmith Basic Template Class (Content in codesmith help)

Source: Internet
Author: User

Basic templates
Type description:
Batch
The outputfilecodetemplate template inherits this class to save their output to the file during the generation process.
Scripterror has an error in script execution.
Scripterrorcollection
Scriptresult the running result of a script contains some errors that have already occurred.
Scriptutility can be used to execute SQL scripts in the database.
Sqlcodetemplate inherits this type of template when generated from an SQL data sourceCodeCan get a lot of useful help methods
Stringutility multiple string-type Processing Methods

Member attributes and methods for each type
Batch class
Attribute
Content
Linecount
Startlinenumber
Method
Finalize obtains idle resources and performs other clearing operations before an object is created again.
Memberwiseclone creates a copy of an existing object

Outputfilecodetemplate class
Attribute
Codetemplateinfo: Get the information of the current template
Outputfile this attribute is used to specify an output file name for saving the template output.
PROGRESS provides a way to report the execution process of the template.
The response template outputs the returned stream. This attribute can be found inProgramWrite stream
Status of the state template instance
Validationerrors: Template Error
Method
Copypropertiesto copies the matching attributes to another code template instance.
Getcodetemplateinstance overload to get the instance of the specified Template
Getfilename is the default name for the template output.
Getproperties: Get all attributes of the template.
Getproperty: Get the specified attribute of the template.
Getrequiredproperties
GetType: Get the current instance type
Default Value of parsedefaultvalue parsing attribute
Savepropertiestoxml saves attributes in XML
Savepropertiestoxmlfile
Setproperty overload to save the specified property value
Tostring

Scripterror class
Attribute

Method
Finalize obtains idle resources and performs other clearing operations before an object is created again.
Memberwiseclone creates a copy of an existing object

Scriptutility class
Attribute
This connection string is used when connectionstring executes the script
Script Execution script
Method
Execute the script

Sqlcodetemplate class
Attribute
Codetemplateinfo: Get the information of the current template
Outputfile this attribute is used to specify an output file name for saving the template output.
PROGRESS provides a way to report the execution process of the template.
The response template outputs the returned stream. This attribute can write a stream in the program
Status of the state template instance
Validationerrors: Template Error
Method
Copypropertiesto copies the matching attributes to another code template instance.
Getcamelcasename returns a camel cased name from the given identifier.
Getcodetemplateinstance overload to get the instance of the specified Template
Getcsharpvariabletype returns the variable type of C # Based on the given column
Getfilename is the default name for the template output.
Getmembervariabledeclarationstatement
Overload: returns the C # member variable declaration statement.
Getmembervariabledefaultvalue
Returns a default value based on the data type of a column.
Getmembervariablename returns a C # member variable name for a given identifier.
Getproperties: Get all attributes of the template.
Getproperty: Get the specified attribute of the template.
Getpropertyname: returns the name of the public attribute of the specified column.
Getreadermethod returns the name of the typed Reader Method for a given column.
Getrequiredproperties
Getspacedname returns a spaced out version of the identifier.
Getsqldbtype returns the sqldbtype of a given column
Getsqlparameterextraparams
Generate additional parameters for the ADO parameter Declaration
Getsqlparameterstatement
Returns the T-SQL parameter Declaration for the given column.
Getsqlparameterstatements
Overload, add a parameter to the specified column to the ADO object to generate a specified declaration (generates an assignment statement that adds a parameter to a ADO object for the given column .)
Getvalidatestatements generates a confirmation statement based on a column.
Includeemptycheck determines whether a given column can be blank
Includemaxlengthcheck determines whether the type of a given column requires the definition of the maximum length.
Isuserdefinedtype determines whether a given column uses a UDT (user-defined type)
Default Value of parsedefaultvalue parsing attribute
Savepropertiestoxml saves attributes in XML
Savepropertiestoxmlfile
Setproperty overload to save the specified property value

 

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.