The connection string of the first MVC code. I changed that. How to reinitialize a database?

I mean, I used the .SDF file, but then there were problems with working with my host. So, I returned to the SQL DB, which I already have, but I noticed that when I go to the default MVC 4 page, it looks for this entity that I already created when I used the original DB .. but this table does not exist with the new SQL DB I switched to ..

I have already verified that this indicates a new purchase of the database by setting the connection string in the constructor.

How do I tell the code "RE CREATE TABLE" before trying to use it?

0
source share
1 answer

If I understand your question correctly, you are looking for something like Entity Framework migration: http://www.hanselman.com/blog/EntityFrameworkCodeFirstMigrationsAlphaNuGetPackageOfTheWeek10.aspx

+1
source

Source: https://habr.com/ru/post/1347617/


All Articles