forked from MDCPS/DamageAssessment_Backend
Database integration
This commit is contained in:
@ -4,11 +4,16 @@ namespace DamageAssesment.Api.SurveyResponses.Db
|
||||
{
|
||||
public class SurveyResponseDbContext:DbContext
|
||||
{
|
||||
public DbSet<Db.SurveyResponse> SurveyResponses { get; set; }
|
||||
|
||||
public SurveyResponseDbContext(DbContextOptions options) : base(options)
|
||||
private IConfiguration _Configuration { get; set; }
|
||||
public SurveyResponseDbContext(DbContextOptions options, IConfiguration configuration) : base(options)
|
||||
{
|
||||
|
||||
_Configuration = configuration;
|
||||
}
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||
{
|
||||
// connect to sql server with connection string from app settings
|
||||
options.UseSqlServer(_Configuration.GetConnectionString("SurveyResponseConnection"));
|
||||
}
|
||||
public DbSet<Db.SurveyResponse> SurveyResponses { get; set; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user