单个文件的两个自定义工具? [英] Two Custom tool s for a single file?

查看:44
本文介绍了单个文件的两个自定义工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的 dbml(Linq to Sql) 文件中生成一些代码,dbml 文件放在我项目的很多部分所以我为此编写了一个自定义工具

I want to generate some code from my dbml(Linq to Sql) file,the dbml file is placed in many part of my project So I wrote a custom tool for this purpose

但是问题是dbml已经包含了MSLinqToSQLGenerator自定义工具,

But the problem is that dbml already has contained MSLinqToSQLGenerator custom tool ,

那么您知道有什么方法可以为一个文件设置两个自定义工具吗?如果没有,请告诉我您对此的想法

So do you know any way to set two custom tools for one file, If no, Let me know your idea about that

推荐答案

如果您在模板职责中包含 LINQ to SQL T4 生成器,您将获得对 T4 的适当控制.

You'd get proper control on the T4 if you include the LINQ to SQL T4 generator in your template's responsibility.

如果我理解正确,您希望保留 .dbml 生成器的默认行为,但也要添加自己的行为.

If I understood properly, you want to keep the default behavior of .dbml generator, but also add your own.

这看起来有点旧",我有一段时间没有亲自使用 LINQ to SQL,但我确实使用了这个 T4 生成器的原样替代品,它产生了标准 .dbml 生成器.

This seemed a bit "old", and I haven't personally used LINQ to SQL for some time, but I did use this as-is replacement of T4 generator, that produced the equivalent of the standard .dbml generator.

https://github.com/damieng/L2ST4

不确定这是否是 VS 2010 版本的最新版本,但您始终可以比较标准 .dbml 生成的代码和此 T4 输出,并进行适当的更改以获得相同的结果.

Not sure if that's up to date with VS 2010 version, but you can always compare the standard .dbml generated code and this T4 output and make proper changes to achieve identical outcome.

当然,您可以简单地拥有多个不同的生成器,只需使用转换所有模板"来运行它们,但根据您的问题,您希望生成器附加到特定于文件的自定义工具.

Of course you can simply have multiple different generators, and simply run them with "Transform All Templates", but based on your question, you'd want the generator to be attached to the file specific custom tool.

您可能还想查看(除非您已经熟悉它)T4 Toolbox https://github.com/olegsych/T4Toolbox 将T4ScriptFileGenerator"自定义工具添加到文件中.它在文件更改时有效地运行 T4 代码.

You might want to check out (unless its already familiar to you) also T4 Toolbox https://github.com/olegsych/T4Toolbox that adds "T4ScriptFileGenerator" custom tool to a file. It effectively runs the T4 code when the file changes.

这篇关于单个文件的两个自定义工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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