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开发者_StackOverflow中文版 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?
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.
精彩评论