Modify asp.net mvc model database

I used mvcScaffolding and mvc3 to create my tables in sql2008 database. some data has been added.

I have changed one model and want to change the base table.

  • Is there a way to automatically update one table in order to synchronize it with the model?
  • after adding a new model, how can I create a database table without recreating the database
+4
source share
2 answers

You are looking for something like a Rails migration. There are a couple of .NET migration providers floating around, but the basic setup you described does not support schema changes without re-creating the database (at least in my experience).

+1
source

Have you tried to treat your database as existing, as described in this example by Scott Gu?

http://weblogs.asp.net/scottgu/archive/2010/08/03/using-ef-code-first-with-an-existing-database.aspx

Hope you don't have to re-create your db every time a change is needed ...

Hello

Floor

+1
source

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


All Articles