Add a comment for the entity generated by EF DbContext (T5 template app) [go]

Source: Internet
Author: User

1 Add Class Comments First

Find this line of code Writeheader (Codestringgenerator, FileManager);

Add our code below it:

String summary=String. Empty;foreach (var entityIn Typemapper.getitemstogenerate<entitytype> (itemcollection)) {Filemanager.startnewfile (entity. Name +". cs"); Beginnamespace (code);if (entity. documentation!=null&&entity. documentation.summary!=null) summary=entity.    Documentation.summary; else summary=entity. Name; #><#=codestringgenerator.usingdirectives (inheader:false) #>//<summary>//  <#=summary#>             //</summary>

While saving the TT template file, the class comments are added

2 Plus attribute comments

Find this line of code foreach (Var edmproperty in simpleproperties)

Add our code underneath it.

foreach (var edmpropertyIn simpleproperties) {if (edmproperty.documentation! =Null && edmProperty.Documentation.Summary! =NULL) summary=edmproperty.documentation.summary;else summary="";  #>//<summary>//  <#=summary#>/    </summary> <#= Codestringgenerator.property (edmproperty) #>         

While saving the TT template, our class attribute comments are added.

In fact, this TT template annotated principle is to read the edmx file (is an XML file) related comments to the Poco entity class annotated, if there is no comment in the EDMX, this database comment can not be added to

Add a comment for the entity generated by EF DbContext (T5 template app) [go]

Related Article

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.