I'm trying to generate my database using code-first. When I run the command update-database, I receive that database cannot be null, but I expected that database would be automatically created. Any idea what I am missing?
services.AddControllers();
}
public class SmartSchoolContext : DbContext
{
public DbSet<Aluno> Alunos { get; set; }
public DbSet<Professor> Professores { get; set; }
public DbSet<Disciplina> Disciplinas { get; set; }
public DbSet<AlunoDisciplina> AlunosDisciplinas { get; set; }
public SmartSchoolContext(DbContextOptions options) : base(options)
{
}
}
}
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<SmartSchoolContext>(context => context.UseMySQL(Configuration.GetConnectionString("Default")));
services.AddControllers();
}