Scaffolding ASP.NET giving error

Asked

Viewed 808 times

1

The error is generated using VS 2012. When I try to create the Controller for my News using the Entity framework, I have tried several ways. o My database you can see in the server explorer on the left.

I’m trying to create the controller for CRUDS.

erro VS

"Unable to Retrieve Metadata for "Braverybranded.ASP.Models.News". Object Reference not set to an instance of an Object."

  • You have already compiled the project?

  • @Andréleria yes

  • @Luiznegrini Apparently the approach is Database-First. You can see the tables through your connection to the database there on Server Explorer?

  • @I got it, I got it! But I’ll inform you that the error was the same folder where the model was, I took it from the "Area" Admin and put it in the default model folder created by the project and everything worked! Thanks in advance!

  • Okay, I’m just asking you to mark your response on the green icon as accepted, for the benefit of everyone in the community. Thank you!

2 answers

1


The problem occurred because the model folder was not the default created by VS. I had left my models inside admin 'Area', so it didn’t work.

To solve just move to the default Model folder and try to use scaffolding again.

  • This solved and your problem and is the most correct answer? Accept it to leave marked for all.

0

You have already rebuilt your application ? if you are scaffolding you need to rebuild after changing the properties of a class.

  • Yes, the problem does not occur because the used classes are not in the Models folder outside the 'Areas' folder'?

  • Right, you managed to use scaffolding for any other class? Do they all give the same error? If none works check that the mvcscaffolding installation is correct, see how to verify:(http://stackoverflow.com/questions/16148914/cannot-add-a-mvc-controller-vs2012-gives-object-reference-not-setto-an-instanc)

  • Really works for none.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.