Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 10, 2012 01:07 AM by cbae
Apr 11, 2012 11:51 AM|LINK
I have a MVC 4 project. After successfully adding a Controller (using SPA template) and compiling, I tried to add another controller but on the Add Controller dialog there this message saying "No model classes are available".
I think it happens after I NuGet EF 4.3 (upgrading from 4.1).
Apr 11, 2012 12:18 PM|LINK
You need to BUILD or REBUILD your solution any time after you create your model before you create a new controller.
Hope can help.,
Apr 11, 2012 12:36 PM|LINK
Thanks for the reply.
I already tried to build, rebuild, clean and rebuild... it doesn't help.
It happens in different projects (in different solutions), only after I upgrade from EF 4.1 to EF 4.3.
Apr 13, 2012 08:02 AM|LINK
I had same problem.
I try delete all class of DbDataController in Controllers folder. & re-build all. Then it looks can create a new control.
Then I backup all old class of DbDataController that was removed, & re-build all.
It looks like a issue, if you update EF version from EF 4.1 to EF 4.3.1 & EF 5.
Apr 15, 2012 06:25 AM|LINK
So every time, when I'd like to add a new controller I have to follow this procedure?
Apr 15, 2012 09:07 AM|LINK
Report this bug at：http://connect.microsoft.com/.
Apr 15, 2012 09:43 AM|LINK
do you upgraded EF AFTER having created a DbDataController?
The point is that while in theory one can upgrade or add a Nuget package also on an existing project....in practice this is very likely to create problems, expecially if you use various type of scaffolding.
Apr 15, 2012 10:14 AM|LINK
I just reported it.
Apr 15, 2012 10:16 AM|LINK
No, I upgraded the EF first thing after creating the project.
Here are the steps to reproduce:
1. Open Visual Studio 2010 (Professional)
2. Create new project from the template "ASP.NET MVC 4 Web Application"
3. On the "Project Template" dialog select "Single Page Application", use Razor, leave the "Create a unit test project" option unchecked (all default)
4. Open the NuGet "Package Manager Console" and update the Entity Framework (currently to version 4.3.1) by running "Install-Package EntityFramework"
5. Build the project
6. Add a new controller by following the instructions inside the example TodoItem.cs file. Basically, creating a new controller using the Single Page Application template, using the TodoItem as the model class and creating a new data context class. This will
create (among other files) a new controller inheriting from DbDataController.
7. Build the project
8. Try to add a new Controller - the Model class selection drop down box is replaced with a red X icon and a message: "No model classes are available".
Apr 15, 2012 12:08 PM|LINK
The point is that according to your description ACTUALLY there not other classes you can use as models for your DBDataController because you have not added new contexts or new classes to the existing context