I am starting a project with EF Core, were the database already exists. I have the database structure as an sql script, that I would like to run every time I initialize the context, in order to have a fresh database every time I would run the application. Here follows a snippet from the traditional EF, showing what I would like to achieve with EF Core.
internal sealed class AnnotationContextDatabaseInitializer : DropCreateDatabaseAlways<AnnotationContext>
{
public override void InitializeDatabase(AnnotationContext context)
{
base.InitializeDatabase(context);
context.Database.ExecuteSqlCommand(TransactionalBehavior.EnsureTransaction, File.ReadAllText("dropAndCreateEntireDatabase.sql"));
}
}