Error in creating SQL Server table with Entity Framework

Asked

Viewed 132 times

0

Delete a table from my project directly in Management Studio. Now when I run the application this error is returned:

system.data.sqlclient.sqlexception: Nome de objeto 'dbo.ContasPagarParcelas' inválido.

I cannot recreate the table. I am using Entity Framework.

  • You removed the table from the database but did not remove it from the EF context. If you doubt how to do this, post in your question the code of your context, where you define the Dbset of the table you removed.

  • Rodrigo, I really want the table to be recreated. Deletes directly into the database to see what behavior the Entity would have when running the system again. Believed that the table would be recreated again.

  • From what I understood in your reply, removing from context would be in case you no longer use this table, correct ?.

  • You should use Codefrist, and you should do Migration, right? if you create Migrations, delete the migration files, and have them create one again. If it doesn’t work, in your database you have a table with migration history, you should delete

  • Rodrigo, I managed to resolve as your guidelines. Thank you very much.

  • òtimo, I am happy. If you can click on the orange arrow of my comment, which is on the left side, I thank you, because it punctuates my help. vlw!

  • Rodrigo, sorry I can’t find the orange arrow.

  • When you hover over my message, on the left side appears a triangle, just click on it.

  • I put, as an answer, then you can click the V, which is on the left side of the answer, in this way we obey the flow of the site.

Show 4 more comments

1 answer

0


You should use Codefrist, and you should do Migration, right? if you create Migrations, delete the migration files, and have one created again.

If it doesn’t work, in your database you have a table with migration history, you should delete

Browser other questions tagged

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