MVC Code First Connection String. I changed it. Ho

2019-09-09 05:27发布

I mean I was using a .SDF file but then had issues getting that to work with my host. So then I went back to the SQL DB I already have but I noticed that when I go to the default MVC 4 index page it is looking for that 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 already verified that is is pointing to the new DB buy setting the connection string in the constructer.

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

1条回答
来,给爷笑一个
2楼-- · 2019-09-09 05:52

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

查看更多
登录 后发表回答