public static void Initialize(bool recreate = false, bool skipSeeding = false) { using (var ctx = new PeopleSearchContext()) { // remove the database if we've been asked to recreate it if (recreate) { ctx.Database.EnsureDeleted(); } // ensure the database is created; we'll never migrate, so this is fine // for demonstration purposes if (ctx.Database.EnsureCreated() && !skipSeeding) { // add some interesting seed data; we'll use some census name data to make // our test data resemble reality ctx.People.AddRange(SampleDataGenerator.GeneratePeople().Take(100)); ctx.SaveChanges(); } } }