Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
152 views
in Technique[技术] by (71.8m points)

visual studio - Is there a way of updating a code first model without using migrations?

We're using Entity Framework 6.1.3. Recently I introduced the idea of using code first with existing database to my coworkers. Prior to that they've been using EDMX files for many years.

One important procedure that is followed where I work is developers must script the creation of tables. Eventually that's so we can hand those SQL scripts over to the DBAs, so they can apply the CREATE TABLE commands into the production database, which developers cannot touch.

However, the procedures by which I must abide makes I have with using using EF's migration with code first an issue. I've never used code first to create a database; those databases have always existed before starting any Visual Studio project to work with the database. From what I understand about updating an existing database from which model classes have been generated using code first, any update will create a Migrations folder in the Visual Studio project where the developer can make the necessary updates to table(s) in the database. That relies upon a Migration table in the database to coordinate the effort, track what's been updated and when, etc. This I get from this blog post. The issue is that I can't use migrations. The idea of that Migrations table won't fly here at work. It might even be dropped. (We're working with SQL Server.)

So, is there another way of updating the model class(es) in a code first with existing database without using EF's migrations?

question from:https://stackoverflow.com/questions/66051837/is-there-a-way-of-updating-a-code-first-model-without-using-migrations

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...