Template generation of dynamic soft Code Generator

Source: Internet
Author: User

Because the project needs to write a lot of repeatedCodeAnd model entity class, all use the template function of the Code Generator to generate the entity and Dal of the csla project.

Perform a simple analysis based on the template usage.

View code

 
<#Foreach(Columninfo CInHost. Keys ){If("Uniqueidentifier"= C. typename. tolower () {#>
Loadproperty <# = codecommon. dbtypetocs (C. typename) #> (OBJ, <# = host. tablename #>. <# = C. columnname #> property, guid. newguid ());
<#}#>< #}#>

<##> A statement block is used to compile the statement that is associated with all the subsequent statements, in fact, I re-combine these <##> statements into the C # syntax for compilation and operation,

For example, columninfo C is also used in the later part of <#>. The if condition sentence in it also needs {}. You can see the combination in it <#}#>.

The template written in it should be noted that there are several points. One is the table's primary key. Right-click the template and choose "save". Remember to save it after writing the template, otherwise the work will be wasted.

It is very convenient to have a soft code generator. If you need to make your own template, you must read the help documentation of developer Li Tianping. Thank you very much for these cool guys.

The following is a custom template adapted to your own csla framework. You need to add the DLL of the csla framework. Many Daniel in the blog Park is studying the csla framework.

Two models in csla, one is the cslamodel file, the other is the calsmodellist of the list set, two data files, one is csladata, and the other is the csladatalist of the list set.

You must define your own template to understand the meaning of the template.

Template: http://files.cnblogs.com/huangyuanfengxue/cslaTemplate.rar

 

 
 

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.