nuclear sweet
nuclear sweet

Reputation: 1121

Entity Framework CodeFirst Migration

I got ASP.MVC application. I use entity framework with default configuration (no connection string provided) so it creates .mdf file in APP_DATA.

If I wanna move my project to another pc and try a clean depoly, should I remove this .mdf from APP_DATA?

Upvotes: 1

Views: 90

Answers (2)

Anshul Nigam
Anshul Nigam

Reputation: 1628

Assuming that you are using Migrations in your project there should not be any problem.
on new machine you can use command
"Update-Database" in your visual studio package manager consol and it will create a new database tables on you new machine.

NOTE: it will only create database schema if you need data also to get copied on to new machine you need to use some export utility.

Upvotes: 1

Christoph Fink
Christoph Fink

Reputation: 23113

If you want to try a clean deployment, then YES. If you copy the database file it will be reused and so the migrations are not run (again), as they are already applied.

Upvotes: 2

Related Questions