Trying to use Mvc 3 Scaffolding on ADO.NET Entity Data Model with existing database. I executed "Scaffold Controller Album" and the controller and view were generated with no errors, and it compiles with no errors or warnings. I errors when run in debug
from VS with the following :
The type 'Scaff.Models.Album' 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.
The generated entity inherits from EntityObject. How am I supposed to generate entities from existing db that are compatible with MvcScaffolding?
RJL4433
Member
50 Points
27 Posts
MvcScaffolding - entity from existing db not mapped
Jun 01, 2011 01:02 AM|LINK
Trying to use Mvc 3 Scaffolding on ADO.NET Entity Data Model with existing database. I executed "Scaffold Controller Album" and the controller and view were generated with no errors, and it compiles with no errors or warnings. I errors when run in debug from VS with the following :
The type 'Scaff.Models.Album' 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.
The generated entity inherits from EntityObject. How am I supposed to generate entities from existing db that are compatible with MvcScaffolding?
VS2010 SP1, MVC3 Tools Update
Thanks for input.
RJ
raduenuca
All-Star
24675 Points
4250 Posts
Re: MvcScaffolding - entity from existing db not mapped
Jun 01, 2011 05:17 AM|LINK
I think MVCScaffolding only works with EntityFramework 4.1.
Have a look at this video:
http://msdn.microsoft.com/en-us/data/gg702905
Radu Enuca | Blog
pghatak
Member
2 Points
1 Post
Re: MvcScaffolding - entity from existing db not mapped
Jul 05, 2011 09:22 PM|LINK
Hello RJ.
I've faced simiar problems, and have managed to solve the issue. This is actually an EF problem, and nothing to do with Scaffolding.
You'd find the solution to this, on my blog here:
http://pinakig.wordpress.com/2011/07/03/mvc-3-scaffolding-issue-with-entity-framework/
Cheers.