Home > Mobile >  Deleting columns from Database doesn't give a mistake in project
Deleting columns from Database doesn't give a mistake in project

Time:10-01

So there's an ASP.Net project that uses Entity Framework Core. Of course, there are Entities classes, Configuration Entities classes, etc. And there are properties in Entities that map some table's columns. Also there is connection string to connect to database. The thing I don't get: I deleted some columns from database table. But project builds and everything is fine. What do I miss? I though that mistake should be given because Entity properties don't map table columns...

CodePudding user response:

A successful build has nothing to do with working code. If you remove columns from the database the project builds, since the project does not have information about the database structure. But as soon as you query for the table where the columns have been deleted, then the code should throw exceptions. I suggest you not to modify the database directly, but read into the topic of EF migrations so that modifying the model updates the database.

  • Related