Have a configuration to prevent migrations seed method from being called


(Forgive me if this is redundant. I did search the issues and discussions for something related and could not find it.)

With EF5 migraitons, the seed method is always called regardless of schema changes. Arthur VIckers explains the logic behind this in this stackoverflow thread (http://stackoverflow.com/questions/10822618/confusion-over-ef-auto-migrations-and-seeding-seeding-every-program-start).

We need more control over when seeding occurs. A DbMigrationsConfiguration setting perhaps?

SeedOnlyWhenSchemaChanges or something like that?

There are ways to solve this in code, but doing so is cumbersome and not discoverable.

Closed Dec 5, 2016 at 10:34 PM by RoMiller
EF Team Triage: We are transitioning this project to GitHub (https://github.com/aspnet/EntityFramework6). As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base.

Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base (https://github.com/aspnet/EntityFramework). Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).

This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include:
• It was a bug report that does not contain sufficient information for us to be able to reproduce it 
• It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it 
• It is a feature request that we are realistically not going to implement on the EF6.x code base
Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider (https://github.com/aspnet/EntityFramework6/issues). We will no longer be monitoring this issue tracker for comments, so please do not reply here.


RoMiller wrote Feb 7, 2013 at 10:21 PM

EF Team Triage: This is small, we should push to get it into EF6 even though it's lower priority.

jlerman wrote Feb 8, 2013 at 12:18 AM


Dave69B wrote Sep 24, 2013 at 3:05 PM

I would appreciate this feature too. Will it be in EF6?

spongman wrote Oct 29, 2013 at 6:53 PM

This is small
really, it seems like an oversight to force the seed method to be run, even if the schema hasn't changed.

what if the seed method takes an hour to run?

johnny_reilly wrote Jun 23, 2014 at 3:28 PM


Just wondering if there was an update on the status of this please? I'm guessing this didn't get released with 6 or 6.1 given the status but I wanted to check...

TDenis wrote Sep 3, 2014 at 8:10 AM

Maybe SeedOnlyWhenSchemaChanges configuration property is not the best solution.
Maybe it`s better to get both seed methods - one that executes every time and the other that executes on schema changes only.
Or to provide some other way to indicate if a schema has been changed.