Answer the question
In order to leave comments, you need to log in
How to sync data when using EF CodeFirst?
I am writing a simple shop on ASP.NET MVC. Since the issue of performance is not worth it, I have chosen SQL Server CE as the DBMS. It's a very stupid question.
So, initially there is a developer version of the base, which is generated by CodeFirst and automatically publishes along with the site to the server, after which it lives its own life there (it fills up). At this time, I am finishing the site and the data structure is gradually building up, i.e. fields and tables are added. Fortunately, EntityFramework in the latest version supports the simplest migrations automatically and data is not lost in the development copy, but what to do with the production copy, which has a lot of data?
After all, at the next publishing, a half-empty developer database will be uploaded to the server? How to configure the studio so that it updates the structure, but does not touch the data?
Answer the question
In order to leave comments, you need to log in
I was also looking for an answer to this question, and did not find anything convenient.
I didn’t like the migrations that appeared - a lot of manipulations, and there is a huge chance to bang the data.
While I'm considering this option. Make your own initializer based on DropCreate, but with a function:
RenameDB -> RenameDB_ver -> CreateDB and TSQL data transfer code RenameDB_ver -> CreateDB.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question