forked from MDCPS/DamageAssessment_Backend
Database integration
This commit is contained in:
@ -4,9 +4,15 @@ namespace DamageAssesment.Api.Surveys.Db
|
||||
{
|
||||
public class SurveysDbContext:DbContext
|
||||
{
|
||||
public SurveysDbContext(DbContextOptions options) : base(options)
|
||||
private IConfiguration _Configuration { get; set; }
|
||||
public SurveysDbContext(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("SurveyConnection"));
|
||||
}
|
||||
public DbSet<Db.Survey> Surveys { get; set; }
|
||||
|
||||
|
Reference in New Issue
Block a user