ITsolutionWizard
asked on
mvc entity framework
i just take over a mvc with entity framework project and the developer is gone.
Now I added a column in the database table, and how can i refresh the entity framework so I can continue to code with linq...?
I am not expert with any projects that using entity framework. hope you can help out.
Thanks
Now I added a column in the database table, and how can i refresh the entity framework so I can continue to code with linq...?
I am not expert with any projects that using entity framework. hope you can help out.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That is database-first. Just make a backup of your models in case the previous developer added code into the autogenerated classes
Go to the Powershell console.
Open VS and navigate to Tools/Package Manager Console
Then run Enable-Migrations (if you got an error, your developer already did this)
if the enable-migrations cmdlet works or fail you should create a new migration (from old DB to new)
add-migration UpdatedCoumnXXXX
you should review the code proposed and if you accept it just run
Update-database
and that's it.
This is if you added the column programmatically if you did it on the DB follow the previous suggestion from @Shaun Vermaak
Documentation in here: https://docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/migrations-and-deployment-with-the-entity-framework-in-an-asp-net-mvc-application
Open VS and navigate to Tools/Package Manager Console
Then run Enable-Migrations (if you got an error, your developer already did this)
if the enable-migrations cmdlet works or fail you should create a new migration (from old DB to new)
add-migration UpdatedCoumnXXXX
you should review the code proposed and if you accept it just run
Update-database
and that's it.
This is if you added the column programmatically if you did it on the DB follow the previous suggestion from @Shaun Vermaak
Documentation in here: https://docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/migrations-and-deployment-with-the-entity-framework-in-an-asp-net-mvc-application