Search code examples
entity-frameworkdesign-patternsef-code-firstentity-framework-migrationsseeding

Entity Framework: Seeding data from the business layer


I am using Entity Framework 6, and code first. I have a Data, Bus, App layers. I wan to seed my data from the business layer, without coupling it onto the Data layer.

The reason I would like to do it in the bus. layer is that some of the seed data is quite specific to the business logic, and I would like to use some of the logic in the bus. layer when I insert into the DB.

Is there way to do this?


Solution

  • I ended up solving this by: EnableMigration -ProjectName DataProject -ContextProjectName BusinessProject

    Works well!