如何用t4模板编辑现有的类模型? [英] how to edit existing class model with t4 template?
本文介绍了如何用t4模板编辑现有的类模型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有一些属性的类模型,需要在set部分添加一段代码:
i have an class model with some properties and need to add piece of code in set section :
class person
{
string _name;
public string Name
{
get
{
return _name;
// code
}
set
{
_name = value;
//adding here
}
}
// other properties
}
how i can do it with t4 template
?
推荐答案
安装Visual Studio Extension有形T4编辑器编辑或创建T4文件并生成POCO类
https ://visualstudiogallery.msdn.microsoft.com/b0e2dde6-5408-42c2-bc92-ac36942bbee9 [ ^ ]
此外,请点击此链接了解如何编写T4文本模板:
https://msdn.microsoft.com/en-us/library/bb126478的.aspx 一> [ ^ ]
Install Visual Studio Extension tangible T4 Editor to edit or create T4 file and to generate POCO classes
https://visualstudiogallery.msdn.microsoft.com/b0e2dde6-5408-42c2-bc92-ac36942bbee9[^]
Also, follow this link on how to write T4 text templates:
https://msdn.microsoft.com/en-us/library/bb126478.aspx[^]
这篇关于如何用t4模板编辑现有的类模型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文