数据库中的Entity Framework 5更新模型不会生成表类 [英] Entity Framework 5 update model from database does not generate table class

查看:118
本文介绍了数据库中的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

这篇关于数据库中的Entity Framework 5更新模型不会生成表类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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