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]