Reputation: 3696
When trying to create a controller in MVC 4 with Scaffolding (EF and CRUD), I got the following error:
"Unable to retrieve metadata for MyModel. The argument 'connectionString' cannot be null, empty or contain only white space."
I spent quite some time trying to figure this out, without any success from all posts I found online. I did however find a way to solve it, and though I would share it here.
My Solution:
For the reference, I am working in Visual-Studio 2012.
This is the way it worked for me. Hopefully it will help any others who are stuck on the same issue. All feedback or better solutions are appreciated
Upvotes: 2
Views: 1827
Reputation: 319
In my Case I just remove the line below from my Context class
Database.SetInitializer(new MigrateDatabaseToLatestVersion<ContextClass, Configuration>());
After that, build and right-click con Controller folder to add a new controller. Done
Upvotes: 2