DDiVita
DDiVita

Reputation: 4265

Database initalizer and seeding data from an SQL script?

I have a few tables that are created by entity framework that house my region and country data. I have a couple SQL scripts that I run after the model is updated, but it is becoming annoying to keep doing that. I would like to automate this a bit. Would I load my script into the Database.ExecuteSqlCommand() method of the context or is there a better way of dealing with this?

Upvotes: 0

Views: 345

Answers (1)

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364259

No if you want automatic way there is no better approach then implementing derived initializer and use override Seed method which will load your scripts and execute them. That is why Seed method exists.

Upvotes: 1

Related Questions