In Visual Studio 2013, I'm creating a Web API Service and have incorporated an ADO.NET Entity Data Model to my project (Database First).
In my edmx diagram, every table I've included has been successfully constructed.
Then I made some adjustments, removing one column and adding two new columns to the original database. Therefore, when I attempt to update my model from the database, two new columns are added, but my model still has the removed column.
Error 11009: Property 'Image' is not mapped.
is the name of the database column that was deleted.
Can this property be manually removed from the model? Or is there a more hygienic and secure approach?
Sure, as others have stated, changing the approach could be a better way to work with EF and DB, but starting from the fact that you need Database First, I think working with Database First Model has its benefits, one of which is the EDMX is taken as is, meaning as a generated piece of code, you can refresh, destroy, and recreate that every time you need or want without losing any modification.
You can remove a property, but the model and database are not transparently in sync because, as I previously stated, the nature of produced code guarantees that every modification you make to the EDMX will be lost.
I believe the greatest strategy for doing that is
Even though this method could be overly straightforward, it doesn't violate the database's inherent integrity.
Just a reminder: Using partial classes to add items to the DbContext and the entities involved to add features and behaviors can help when working with the database first.