Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a controller to ASP.NET MVC with Visual Studio 2013 and Entity Framework?

I am getting an error when I add a controller in Visual Studio 2013 with ASP.NET MVC 5.0 and Entity Framework 6.0. I have already added a few controllers and generated views but after I added the datatables package, I am getting this type of error:

Error 

"There was an error running the selected code generator"

"There was an error getting the type 'project.classes.StudentClass' Try rebuilding the project"

I have cleaned and rebuilt the project but it still isn't working. There is a table named StudentClass and I want to add the controller for that Table using Entity Framework. How can I generate the controller successfully?

like image 302
Csharp Avatar asked Oct 21 '22 09:10

Csharp


1 Answers

If you get an error message that says "There was an error getting the type...", make sure that you built the Visual Studio project after you added the class. The scaffolding uses reflection to find the class.

like image 120
Jorge M V Avatar answered Oct 31 '22 16:10

Jorge M V