Cloud Computing; Windows Azure; .NET Internals; Windows Internals;
Right now I am working with Visual Studio 2013, ASP.NET MVC 5.0 and Entity Framework 6.1.1. One of the things I like about Visual Studio is the ability to generate scaffolded items. e.g. if I want to manage student records I just need to create a c# class named Student and Visual Studio can generate all the CRUD views and controller actions for me. This will save a lot of time and trouble for me.
However things might not always work as expected. I used this code generation feature quite a few times and it worked like a charm. But today it just didn't work. I got the below error. There was an error running the selected code generator:‘Unable to retrieve metadata for ‘HomeHome Models. ServiceproviderReview’. Ambiguous match found’
I did some research and tried the below things. 1. Examine all the fields and properties to make sure that they don't have the same names with different casing 2. Comment out most properties and keep only two properties (int:Id and string:Name) 3. Rename the model, re-compile, regenerate the database 4. Uninstall entity framework 6.1.1 and install 6.0.0 5. Close visual studio and start again 6. Clean the solution and rebuild 7. Create another simple model class to just see what's going on
Unfortunately all of them did not work! In the end I was so frustrated after a couple of hours of trying all kind of things. I was almost going to restart my dev machine. Then I decided to do one last attempt by creating a new DbContext. To my surprise it worked! I think that there must be some bug with Visual Studio / Entity Framework. After that I removed the new DbContext & the new connection string in web.config and switched to use the old DbContext. I was happy to see it still worked.
I have the same problema, but I am new in mvc and I was not able to fix it.
Could you describe your source code?
You don't need to write code. Just choose to create a new DbContext in the dialog and then update it to connect to the same DB. Good luck