在dotnet模板中替换类型和变量
假设我在模板中有一个文件,
private readonly IMyEntityRepository _myEntityRepository;
然后我有一个配置
"symbols": {
"entity": {
"type": "parameter",
"datatype": "string",
"replaces": "MyEntity",
"fileRename": "MyEntity",
"defaultValue": "MyEntity"
}
}
,然后运行命令,就像
dotnet new service-template -n RuleService --entity Rule
我最终得到的
private readonly IRuleRepository _myEntityRepository;
那样,只想
private readonly IRuleRepository _ruleRepository;
使用一个参数才能实现吗?
Lets say I have a file with a peace of code below in my template
private readonly IMyEntityRepository _myEntityRepository;
Then I have a configuration
"symbols": {
"entity": {
"type": "parameter",
"datatype": "string",
"replaces": "MyEntity",
"fileRename": "MyEntity",
"defaultValue": "MyEntity"
}
}
and run the command like
dotnet new service-template -n RuleService --entity Rule
In the end I get
private readonly IRuleRepository _myEntityRepository;
but want to have
private readonly IRuleRepository _ruleRepository;
Is that possible to achieve using just a single parameter?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论