0

前処理された T4 テンプレートでは、テンプレートに値を渡すときに、カスタム ホスト プロパティとパラメーターを使用する規則や適切な方法はありますか?

利点はありますか?

ありがとう

4

1 に答える 1

0

Personally, I like the parameter directive, simply because it makes it very obvious to folks coming along to maintain the template, what the parameter and its type is. The generated code gives you a couple of options for how to resolve those values. However, I know a few folks who much prefer to simply add parameters in a partial class that sits alongside the generated class and use that to set its values, perhaps with a custom constructor.

I think Host properties are a bit of a white elephant in preprocessed templates to be honest, unless you have both preprocessed and design-time versions of the same code.

于 2013-02-05T02:16:21.570 に答える