asp.net mvc - Entity Framework Code First not is not reading model and creating table in database -


previously,i updating database, whenever wanted create table in database, used create model , command

update-database -verbose

and entity framework code first takes care of rest,now, i've been searching hard updating database because not getting updated whenever create model, so, thought of initiating database scratch may work, so, deleted __migrationhistory table database, deleted migrations folder, enabled again, added initial migration, commented out in up() method, , again updating database using same command (update-database -verbose) no gain.

my question why not reading model , creating new table in database? how make command update-database work again because did?

after create new model, either have add migration manually before running update-database alert database change has occurred, or have automatic migrations enabled. can manual migration running following in package manager:

add-migration nameofmigration 

you can enable automatic migrations running following in package manager:

enable-migrations –enableautomaticmigrations 

if go automatic migrations, need run update-database , changes model, including addition of new models, automatically detected , added database.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -