DamageAssessment_Backend/DamageAssesmentApi/DamageAssesment.Api.Questions/Db/QuestionDbContext.cs

39 lines
1.5 KiB
C#
Raw Normal View History

2023-08-15 22:52:30 -05:00
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
namespace DamageAssesment.Api.Questions.Db
{
public class QuestionDbContext : DbContext
{
public DbSet<Db.Question> Questions { get; set; }
public DbSet<Db.QuestionType> QuestionTypes { get; set; }
public DbSet<Db.QuestionsTranslation> QuestionsTranslations { get; set; }
public DbSet<Db.QuestionCategory> QuestionCategories { get; set; }
2023-09-08 14:40:06 -05:00
public DbSet<Db.CategoryTranslation> CategoryTranslations { get; set; }
2023-08-15 22:52:30 -05:00
public QuestionDbContext(DbContextOptions options) : base(options)
{
}
2023-08-25 17:24:46 -05:00
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Question>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
modelBuilder.Entity<QuestionType>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
modelBuilder.Entity<QuestionsTranslation>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
modelBuilder.Entity<QuestionCategory>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
2023-09-08 14:40:06 -05:00
modelBuilder.Entity<CategoryTranslation>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
2023-08-25 17:24:46 -05:00
}
2023-08-15 22:52:30 -05:00
}
}