实体框架5停在节省运行T4模板文件 [英] Entity Framework 5 stopped running T4 templates files on save

查看:86
本文介绍了实体框架5停在节省运行T4模板文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在工作中我们刚刚升级到实体框架5.我们的EDMX文件现在有它下面几个其他节点:

At work we just upgraded to Entity Framework 5. Our EDMX file now has a couple other nodes beneath it:

EntityContainer.Context.tt

,其中包含所生成的DbContext对象以及

which contains the generated DbContext object and

EntityContainer.tt

包含实体本身。

which contains the entities themselves.

有关在短期内,将在EF实体被自动再生TT(T4模板)时,我们会保存EDMX文件。现在,突然之间,我们必须用鼠标右键单击该T4模板,然后选择运行自定义工具,让他们重新生成的.cs文件上下文或实体。

For a short period, adding an entity in EF was automatically regenerating the tt (T4 Templates) when we would save the EDMX file. Now all of a sudden we have to right-click the T4 templates and select "Run Custom Tool" to get them to regenerate the .cs files for the context or entities.

任何想法如何这可能发生?

Any ideas how this might have happened?

在EDMX属性改造相关文件的模板保存时设置为true,问题仍然发生。

In the EDMX the property "Transform Related Text Templates On Save" is set to true and the problem is still happening.

推荐答案

是您的EDMX在项目中的子文件夹?如果是这样,好消息是,你并没有做错什么。坏消息是,这是一个已知的问题......检查我的博客文章了。 <一href="http://thedatafarm.com/blog/data-access/watch-out-for-vs2012-edmx-$c$c-generation-special-case/">http://thedatafarm.com/blog/data-access/watch-out-for-vs2012-edmx-$c$c-generation-special-case/.

Is your EDMX in a sub-folder of your project? If so, the good news is that you didn't do anything wrong. The bad news is that this is a known issue...check my blog post about it. http://thedatafarm.com/blog/data-access/watch-out-for-vs2012-edmx-code-generation-special-case/.

两种解决暂且:

1)移动EDMX到主项目文件夹 2)明确为需要分力C根的$ C $

1) move the edmx into the main project folder 2) explicitly force the code gen as needed

这篇关于实体框架5停在节省运行T4模板文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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