39 lines
1.5 KiB
C#
39 lines
1.5 KiB
C#
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; }
|
|
public DbSet<Db.CategoryTranslation> CategoryTranslations { get; set; }
|
|
public QuestionDbContext(DbContextOptions options) : base(options)
|
|
{
|
|
|
|
}
|
|
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();
|
|
modelBuilder.Entity<CategoryTranslation>()
|
|
.Property(item => item.Id)
|
|
.ValueGeneratedOnAdd();
|
|
}
|
|
}
|
|
}
|