We have been using EF with Code First Migrations for a while, and our DLL has grown to almost 10 megabytes. This may not seem like a big deal, but every time we add a migration to our project, it's causing the DLL to grow.
I've found that excluding the migrations from the project file works okay, and doesn't harm anything (as long as your databases already have those migrations). Is that an acceptable way of handling the bloat, or is there some reason they need to stick around? Or is there an alternative way of keeping the files there in the project but not letting them bloat things so much?
Step 1 − Before running the application you need to enable migration. Step 2 − Open Package Manager Console from Tools → NuGet Package Manger → Package Manger Console. Step 3 − Migration is already enabled, now add migration in your application by executing the following command.
You need to go to Management Studio, open your database tables, go to System Tables folder and remove __MigrationHistory table that is located there (for EF6 and above, it's located directly under Tables ). This will disable Migrations for good.
EF Core compares the current model against a snapshot of the old model to determine the differences, and generates migration source files; the files can be tracked in your project's source control like any other source file. Once a new migration has been generated, it can be applied to a database in various ways.
No, you don't have to include the project with migrations into your deploy package. No "real" project should reference that one. But you do need it for Update-Database
.
(Originally answered in comment.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With