Database Initialization in Entity Framework Code First

c# database ef-code-first entity-framework entity-framework-6

Accepted Answer

Where you are in the development process will determine your answer. On the initializer, which is executed when the database is formed, you may use a Seed() technique. Therefore, I advise against using a DropCreate____ kind of initializer if you have a lot of data and plan to regularly change your models. Instead, I suggest seeding a modest sample size for testing.

Once you are satisfied with the basic design, you may do a complete Seed() and transition to database migrations to manage model updates. This will maintain your current data and provides a separate Seed() function for adding new data.

If you're wondering where to acquire the data, consider something similar, where you could download into a format like csv or xml or retrieve from a web service. either here or at http://www.jokecamp.com/blog/guide-to-football-and-soccer-data-and-apis/#footballdata

2
4/27/2016 6:08:18 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow