asp.net - Code First Enable Migration -


i receive error:

additional information: model backing 'applicationdbcontext' context has changed since database created. consider using code first migrations update database (http://go.microsoft.com/fwlink/?linkid=238269).

go link, , click on tutorial section enabling migrations has link on how this. think link goes? same page. documentation consistently horrendous.

it seems should checkbox somewhere, or line of code need add, don’t know find it.

healy in tampa

the documentation on microsoft site isn't clear. first came across issue needed enable migrations when working on asp.net application relied on entity framework.

the error thrown same:

additional information: model backing 'applicationdbcontext' context has changed since database created. consider using code first migrations update database (http://go.microsoft.com/fwlink/?linkid=238269).

this result of me adding new property 1 of models. when looked @ controller, did not update reflect new property. if navigated http://localhost:59108/controller received message within visual studio 2015 debugger.

to enable migrations, update database when add new property model , controller, following:

navigate package manager console in visual studio. (view -> other windows -> package manager console). enter text:

  1. enable-migrations

when asks name enter name of new table you'd use -- can anything.

(update, @drewjordan: asks name when add-migration, , it's nothing (inherently) new table; it's new migration, , helps give descriptive names migrations. 'addfootobar' adding foo property table bar.)

  1. add-migration

  2. update-database

  3. rebuild project

  4. deploy


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -