实体框架 4 - 更改模型不会更新 T4 自跟踪模板文件
我正在使用自跟踪实体,并通过使用“添加为链接”指向 TT 文件,将实体类移动到另一个程序集 此处。但现在,当我更新模型(例如更改属性名称)时,模板不会自动运行,因此实体类不会更新。
我当然可以手动运行模板来获取更新,但如果它按照我移动类之前的方式自动运行会更容易。有什么办法可以实现这一点吗?
达伦.
I am using self tracking entities and have moved the entity classes to another assembly by using 'Add as link' to point to the TT file as mentioned here. Now though, when I update the model (for instance change a property name) the template is not automatically run and so the entity class does not get updated.
I can of course manually run the template to get the updates, but it would be easier if it ran automatically in the way it did before I moved the classes. Is there any way to achieve this?
Darren.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我还没有这样做,但我怀疑以下是可能的。使用自定义工具标记模型(请参阅解决方案资源管理器中文件的属性)。然后创建一个小程序(请参阅此处查看示例),该程序将执行TT 的运行自定义工具。
I've not done this but I suspect the following is possible. Mark the model with a custom tool (see under properties of the file in solution explorer). Then create a small program (see here for an example) that will execute a the TT's run custom tool.
我还没有遇到这个问题。通常,当我保存模型或构建包含 edmx 文件的项目时,我的实体的代码文件会被更新。您可以通过直接电子邮件与我分享您的项目吗?如果我们无法解决问题,我不介意解决问题,然后与团队跟进。
I have not run into this issue. Usually when i save the model or build the project which contains my edmx file, the code files for my entities are updated. can you share your project with me through direct email. I wouldn't mind trouble shooting the problem and then following up with team if we cant get it to work.