Raja Rajendraprasath
Raja Rajendraprasath

Reputation: 222

Update model from database in entity framework is not working

If any changes have made on the datatype or constraints(e.g. not null - null) of a particular column in table and performing Update model from database (Refresh a particular table) in entity framework is not updating the entity model.

Each time I have to delete and re-create the table manually.

Is this only solution? or any other best way to do this?

Upvotes: 4

Views: 12450

Answers (2)

Joseph L.
Joseph L.

Reputation: 461

Check if the new updated/created table in the database contains an identity key column (like an ID column). Entity Framework is especially sensitive when working with tables that don't represent uniqueness in their records.

Upvotes: 1

Jason Loki Smith
Jason Loki Smith

Reputation: 438

delete the applicable table(s) from your model, than select Update model from database, EF usually only checks for new fields, not changes to existing fields.

Upvotes: 9

Related Questions