数据库中的Entity Framework 5更新模型不会生成表类

问题描述:

我在VS2012中使用EF5,这是数据库优先的方法。

I am using EF5 in VS2012, database first method.

当我向设计图面添加新表X时,该表显示出来,然后保存并编译没有错误。但是,永远不会生成类X(在解决方案资源管理器中的MyModel.tt下)。

When I add a new table X to the design surface, the table shows, then I save and compile without error. However, no class X is ever generated (under MyModel.tt in solution explorer).

如果我右键单击MyModel.tt并选择运行自定义工具,则类生成。

If I right click MyModel.tt and choose "Run Custom Tool", then the classes are generated.

这种行为与我在EF4和VS 2010中遇到的行为不同,在EF4和VS 2010中,这些类是自动生成的。

This behavior is different than what I experienced in EF4 and VS 2010, where the classes are automatically generated.


  1. 是否可以更改此行为,以便自动生成表类?

  2. 为什么不自动生成表类?


这是VS2012中的错误。此处有更多详细信息: http://entityframework.codeplex.com/workitem/453

This is a bug in VS2012. More details here: http://entityframework.codeplex.com/workitem/453