issue on using generated model from EDMX

May 31, 2011 at 4:18 AM


I've just installed visual studio 2010 (SP1) and MVC3 + installed Entity framework getting below error when trying to add new controller from VS or using generated model from EDMX. it seems EntityObject is not missing and project is compiled successfully.

Unable to retrirve metadata for 'X'. The type was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject.

Jul 16, 2011 at 4:53 AM

Hi Ravandi,

The EDMX gives you a different context to work from, and MvcScaffolding doesn't do so well with it. You'll have to override the code generation (don't worry, it's painless) and use the new lightweight DbContext templates.

You can give this a try: