Using the dynamic soft code generator to create a parameter table for a custom template

Source: Internet
Author: User

Host object Property List

Host Object Method list

Tableinfo Table Object Properties

Columninfo Field Information Object

Common methods of Codecommon tool class

Case template with dynamic soft code generator

<#@ template language= "C #" hostspecific= "True" #>
<#@ output extension= ". cs" #>
<#
Tablehost host = (Tablehost) (host);
Host. Fieldlist.sort (Codecommon.comparebyintorder);
Columninfo Identitykey=host. Identitykey;
#>
Database name: <#= host. DbName #>
Database type: <#= host. DbType #>
Table name: <#= host. TableName #>
Table Description: <#= host. Tabledescription #>
Database access class name: <#= host. Dbhelpername #>
Project name: <#= host. ProjectName #>
Stored procedure prefix: <#= host. Procprefix #>
Class naming rules: <#= host. Tabnamerule #>
Database DbType class Name: <#= host. Dbparadbtype #>
Stored procedure parameter symbols: <#= host.preparameter #>
Table collection:
<# foreach (Tableinfo tab in host.) Tablelist)
{
WriteLine (tab. TabName);
} #>
Field collection:
<# foreach (Columninfo C in host. FieldList)
{
WriteLine ("public {0} {1} {{get; Set }} ", Codecommon.dbtypetocs (C.typename), c.columnname);
} #>
Collection of primary key Fields collection:
<# foreach (Columninfo C in host. Keys)
{
WriteLine ("public {0} {1} {{get; Set }} ", Codecommon.dbtypetocs (C.typename), c.columnname);
} #>
Foreign key field collection:
<# foreach (Columninfo C in host. Fkeys)
{
WriteLine ("public {0} {1} {{get; Set }} ", Codecommon.dbtypetocs (C.typename), c.columnname);
} #>
Model class Name: <#= host. Getmodelclass (host. TableName) #>
BLL class Name: <#= host. Getbllclass (host. TableName) #>
Dal class Name: <#= host. Getdalclass (host. TableName) #>
<#= Codecommon.dbparadbtype (host. DbType) #>
<#= Codecommon.preparameter (host. DbType) #>
<#= Codecommon.getwhereparameterexpression (host. Keys,true,host. DbType) #>
<#= Codecommon.getpreparameter (host. Keys,true,host. DbType) #>
<#= Codecommon.getinparameter (host. Keys,true) #>
<#= Codecommon.getfieldstrlist (host. Keys,true) #>
<#= Codecommon.getwhereexpression (host. Keys,true) #>

Using the dynamic soft code generator to create a parameter table for a custom template

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.