CodeSmith 是一种基于模板的代码生成工具

 

CodeSmith 是一种基于模板的代码生成工具,它使用类似于 ASP.NET 的语法来生成任意类型的代码或文本。与其他许多代码生成工具不同,CodeSmith 不要求您订阅特定的应用程序设计或体系结构。使用 CodeSmith,可以生成包括简单的强类型集合和完整应用程序在内的任何东西。 

当您生成应用程序时,您经常需要重复完成某些特定的任务,例如编写数据访问代码或者生成自定义集合。CodeSmith 在这些时候特别有用,因为您可以编写模板自动完成这些任务,从而不仅提高您的工作效率,而且能够自动完成那些最为乏味的任务。CodeSmith 附带了许多模板,包括对应于所有 .NET 集合类型的模板以及用于生成存储过程的模板,但该工具的真正威力在于能够创建自定义模板。为了使您能够入门,我将快速介绍一下如何生成自定义模板。 


生成自定义模板 
CodeSmith 模板只是一些可以在任意文本编辑器中创建的文本文件。它们的唯一要求是用 .cst 文件扩展名来保存它们。我将要生成的示例模板将接受一个字符串,然后基于该字符串生成一个类。创建模板的第一步是添加模板头,它可声明模板的语言、目标语言以及简要模板说明: 

CodeSmith 由 Eric J. Smith 编写,并且可以在 http://www.ericjsmith.net/codesmith 下载。 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)CodeSmith+注册码(注册机)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值