There’s a known problem with EDMX code generation in VS2012. I’ve tested this a number of ways in VS2010 and can’t reproduce the problem there so it seems to be specific to VS2012.
The problem occurs when you have your model inside of a project folder such as in this screen shot:
When you make changes to your model, normally, saving the model will trigger the code generator to regenerate the classes.
But when the model is inside a folder, this won’t happen. (It’s not intentional…just a bug.) And you may not realize that this is the problem that’s causing you to have problems during development. Instead you won’t be able to use new (or modified) entities or properties when you are coding against the model because the generated classes weren’t updated.
So, for example, if you change an entity from Contact to Person, (and the EntitySet name will then change from Contacts to People), when you try to write a query against context.People, “People” will not exist as an option. Or if you try to write code related to Person, there will be no such class available.
This is a known issue and has been logged as an item for Entity Framework on the CodePlex site. You can vote for it to raise it’s priority level here: http://entityframework.codeplex.com/workitem/453.
In the meantime, if you want to keep your edmx file inside a project folder, you can still force the code generation to happen by selecting Run Custom Tool from the context menu of the Context.tt file and the model.tt file. Be sure to update BOTH files so that any entity name changes will get picked up by the context as well.
Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!