private static void SetupDatabase()
{
using (var db = new BloggingContext())
{
db.Database.EnsureCreated();
if (db.Blogs.Any())
{
db.Database.ExecuteSqlCommand("DELETE FROM dbo.Blogs");
}
db.Blogs.Add(new Blog { Name = "The Dog Blog", Url = "http://sample.com/dogs" });
db.Blogs.Add(new Blog { Name = "The Cat Blog", Url = "http://sample.com/cats" });
db.SaveChanges();
}
}
}