T4模板循环生成插入语句

<#@ template debug="false" hostspecific="false" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <# for (int i = 1; i < 22; i++) { #> insert into tb_sys_module (f_id, f_parentid, f_layers, f_encode, f_fullname, f_icon, f_urladdress, f_target, f_ismenu, f_isexpand, f_ispublic, f_allowedit, f_allowdelete, f_sortcode, f_deletemark, f_enabledmark, f_description, f_creatortime, f_creatoruserid, f_lastmodifytime, f_lastmodifyuserid, f_deletetime, f_deleteuserid, f_ismodule) values ( '<#= Guid.NewGuid().ToString()#>', '8a579654-de20-4189-80c4-cfc6979cac76', '', '', '', 'fa fa-file', '', 'iframe', 1, 0, 0, 0, 0, <#=i#>, '', 1, '', <#=DateTime.Now.ToString()#>, '9f2ec079-7d0f-4fe2-90ab-8b09a8302aba', '', '', '', '', '否'); <#}#>

原文地址:https://www.cnblogs.com/Anthony518/p/11570373.html