I haven't mentioned it in the steps above, but even after creating new classes in the domain, I get the same problem.
I also think that it shouldn't care to create another controller for the same class, so running out of classes to create controllers on shouldn't be a problem. But I'm not sure and either way, it happens when I have many other classes in the model too.
Try on point 4, add "Install-Package SinglePageApplication.CSharp", and you get message:
Error 1 Compiling transformation: The type or namespace name 'MvcTextTemplateHost' could not be found (are you missing a using directive or an assembly reference?) c:\Temp\MvcApplication3\MvcApplication3\CodeTemplates\AddController\SpaController.tt 3 1
Forget this message, just continue, your procedure become like these:
Open Visual Studio 2010 (Professional)
Create new project from the template "ASP.NET MVC 4 Web Application"
On the "Project Template" dialog select "Single Page Application", use Razor, leave the "Create a unit test project" option unchecked (all default)
Open the NuGet "Package Manager Console" and update the Entity Framework (currently to version 4.3.1) by running
"Install-Package SinglePageApplication.CSharp"
"Install-Package EntityFramework"
Build the project
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.
Build the project
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".
In the real project, I am updating the SinglePageApplication.CSharp through NuGet but I'm doing it after updating th EF. So for a second there I thought the problem was the order in which I perform the updates.
I tried it again according to your suggestions - updating SPA first - still the same problem.
Can you BUILD or REBUILD the project without any error? The message "No model classes are available" also happend when there is a syntax error on a project.
If still happend, is it posible to put your project on skydrive or other public folder?
sagy
0 Points
8 Posts
Re: Can't create new controller, "No model classes are available"
Apr 15, 2012 12:15 PM|LINK
I haven't mentioned it in the steps above, but even after creating new classes in the domain, I get the same problem.
I also think that it shouldn't care to create another controller for the same class, so running out of classes to create controllers on shouldn't be a problem. But I'm not sure and either way, it happens when I have many other classes in the model too.
Thanks,
Sagy
francesco ab...
All-Star
20954 Points
3286 Posts
Re: Can't create new controller, "No model classes are available"
Apr 15, 2012 12:21 PM|LINK
I understand.....in this case....it is a TRUE bug..., a kind of incompatibility with the new version of EF.
Mvc Controls Toolkit | Data Moving Plug-in Videos
jsiahaan
Contributor
2550 Points
645 Posts
Re: Can't create new controller, "No model classes are available"
Apr 15, 2012 12:46 PM|LINK
Hi Sagy,
Try on point 4, add "Install-Package SinglePageApplication.CSharp", and you get message:
Forget this message, just continue, your procedure become like these:
Hoe this can help
Indonesian Humanitarian Foundation
sagy
0 Points
8 Posts
Re: Can't create new controller, "No model classes are available"
Apr 15, 2012 01:11 PM|LINK
jsiahaan,
In the real project, I am updating the SinglePageApplication.CSharp through NuGet but I'm doing it after updating th EF. So for a second there I thought the problem was the order in which I perform the updates.
I tried it again according to your suggestions - updating SPA first - still the same problem.
Thanks.
jsiahaan
Contributor
2550 Points
645 Posts
Re: Can't create new controller, "No model classes are available"
Apr 15, 2012 01:51 PM|LINK
Hi,
I have tried the modified procedure on my prevoius reply, on VS 2010, on Win Server 2008R2, and VS 11 on Win 8 Consumer preview, both are fine. The one who help me at the beginning of SPA is KDegrave, you may look at him at http://www.kristofdegrave.be/2012/04/upshotjs-knockoutjs-html5-client-for.html, this address was from him when he replied my question on my thread http://forums.asp.net/t/1788069.aspx/1?Single+Page+Application+Prerequirement
Best wishes
Indonesian Humanitarian Foundation
jsiahaan
Contributor
2550 Points
645 Posts
Re: Can't create new controller, "No model classes are available"
Apr 15, 2012 01:59 PM|LINK
Hi Sagy,
Can you post your new model class, I need to produce your case.
When I did in VS 11, I did not do "Install-Package EntityFramework"
Have fun
Indonesian Humanitarian Foundation
Peter Xie
Member
7 Points
3 Posts
Re: Can't create new controller, "No model classes are available"
Apr 15, 2012 08:56 PM|LINK
Hi,
It not happen when you don't version up to EF 4.3.1 or EF 5 bate.
If you don't need new EF version you can still use EF 4.1.
May be It is a way for continue with new EF version.
First need delete all created controls, than you can create a new control.
When all finished you can backup all deleted controls to it.
TimoYang
Contributor
3732 Points
1275 Posts
Re: Can't create new controller, "No model classes are available"
Apr 16, 2012 03:12 AM|LINK
So u've reported a bug and Maybe it's so……Hope MS kind men will reply to you sooooooooooon……
Peter Xie
Member
7 Points
3 Posts
Re: Can't create new controller, "No model classes are available"
Apr 16, 2012 04:39 AM|LINK
^^. I hope so, we haven't time to stop jub for wait new.
jsiahaan
Contributor
2550 Points
645 Posts
Re: Can't create new controller, "No model classes are available"
Apr 17, 2012 02:09 AM|LINK
Hi Sagy
Can you BUILD or REBUILD the project without any error? The message "No model classes are available" also happend when there is a syntax error on a project.
If still happend, is it posible to put your project on skydrive or other public folder?
Have fun
Indonesian Humanitarian Foundation