如何使用T4产生两个文件在从一个模板同时? [英] How to use T4 to generate two files at the same time from one template?

查看:294
本文介绍了如何使用T4产生两个文件在从一个模板同时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在我需要产生两个CSHARP code以pretty的文件相同的code,但这些方法的输入和输出类型不同的命名空间的情况。其实每个文件都是针对某一特定国家和类型来自特定国家的WSDL的。

I am having a case in which I need to generate two CSharp code files with pretty the same code but different namespace of the input and output types of the methods. In fact each file is for a specific country and the types come from country specific WSDL's.

我写围绕服务的一些包装和逻辑是完全一样的,但来自WSDL的自动生成的类型是不同的。我怎么能减少编码工作,并编写逻辑在一个地方,并得到它两套不同类型的产生?

I am writing some wrappers around the services and the logic is exactly the same but the types automatically generated from WSDL's are different. How could I reduce the coding effort and write the logic at one place and get it generated for two different sets of types?

推荐答案

或者你可以使用 T4工具箱和使用佣工生成多个文件。 - > 博客帖子与解释

or you could use the T4 Toolbox and use the helpers to generate multiple files. -> Blog post with explanation.

或者,如果你不希望这种依赖只是为了这个功能,您可以使用T4文件MultiOutput.tt,你可以找到<一href="http://www.olegsych.com/2008/03/how-to-generate-multiple-outputs-from-single-t4-template/">here与解释。

Or if you don't want this dependency just for this functionality, you can use the T4 file MultiOutput.tt that you can find here with explanation.

这篇关于如何使用T4产生两个文件在从一个模板同时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆