public static void Main(string[] args) { var host = BuildWebHost(args); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { CandidatoContext context = services.GetRequiredService <CandidatoContext>(); using (DbInitializer init = new DbInitializer(context)) { init.Seed(); } } catch (Exception ex) { var logger = services.GetRequiredService <ILogger <Program> >(); logger.LogError(ex, "An error occurred while seeding the database."); } } host.Run(); }
protected override void Down(MigrationBuilder migrationBuilder) { using (var candidatoContext = new CandidatoContext()) { candidatoContext.RemoveRange(candidatoContext.Candidatos); candidatoContext.SaveChanges(); } }
protected override void Up(MigrationBuilder migrationBuilder) { using (var candidatoContext = new CandidatoContext()) { candidatoContext.Candidatos.AddRange(Candidatos()); candidatoContext.Candidatos.AddRange(Candidatos()); candidatoContext.Candidatos.AddRange(Candidatos()); candidatoContext.Candidatos.AddRange(Candidatos()); candidatoContext.Candidatos.AddRange(Candidatos()); candidatoContext.SaveChanges(); } }
public Repository(CandidatoContext context) { _context = context; }
public EstadoRepository(CandidatoContext context) : base(context) { }
public CidadeRepository(CandidatoContext context) : base(context) { }
public CandidatoController(CandidatoContext context) { _context = context; }
public DisponibilidadeRepository(CandidatoContext context) : base(context) { }
public HorarioRepository(CandidatoContext context) : base(context) { }