One option is to create your own DatabaseInitializer, which inherits from DropCreateDatabaseAlways.
An example of this might be.
public class MyInitializer : DropCreateDatabaseAlways<EmployeeContext>
{
protected override void Seed(EmployeeContext context)
{
context.Employees.Add(new Employee() {FirstName = "Marcy"});
base.Seed(context);
}
}
public class EmployeeContext : DbContext
{
static EmployeeContext()
{
Database.SetInitializer(new MyInitializer());
}
public IDbSet<Employee> Employees { get; set; }
}
source
share