I've seen a number of posts here and on the internet written by people like me who would like to use MvcScaffolding on an existing project who makes use of an EF4.1 EDMX model, pointing to an existing DB where EFCodeFirst conventions cannot be enforced.
mainly for performace reasons I do not intend to use EFCode First as my main DAL in this project.
If you try and scaffold entities without any trick, in this case, at runtime you get the dreaded:
"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
As a matter of fact, types generated from EDMX's really do inherit from EntityObject, as the error complains.
What I've tried (unsuccesfully) to make it work:
1) Using MVC3 Powertools -> reverse engineering db to create some codefirst entities. this doesn't seem to work, and even if it would, it would be a pain to regenerate each time and to have duplicate entities types
2) Tried this
http://www.programgood.net/2011/03/14/MVC3MvcScaffoldingAndEFModelFirst.aspx with no success, the scaffolding is not done altogether:
Get-PrimaryKey : Cannot find primary key property for type 'XXXX'. No properties appear to be primary keys.
Get-ProjectType : Cannot find a type matching the name 'XXXXXContext'. Try specifying the fully-qualified type name, including namespace.
3) deleted everything and tried making POCO classes with http://visualstudiogallery.msdn.microsoft.com/23df0450-5677-4926-96cc-173d02752313
at this point I am clueless, but I am sure there's a proven way to do this, and you can tell us :)