Entity Framework 5 update model from database does

2019-01-11 13:54发布

问题:

I am using EF5 in VS2012, database first method.

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).

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

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

  1. Can I change this behavior so that the table classes are automatically generated?
  2. Why aren't the classes for tables generating automatically?

回答1:

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



回答2:

This was fixed in the VS 2012 Update 1 that was shipped today. You can get it from: http://www.microsoft.com/visualstudio/eng/downloads#d-visual-studio-2012-update