DamageAssessment_Backend/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Db/DoculinkDbContext.cs

39 lines
1.5 KiB
C#
Raw Normal View History

2023-09-22 10:52:17 -05:00
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using System.ComponentModel.DataAnnotations;
namespace DamageAssesment.Api.DocuLinks.Db
{
public class DoculinkDbContext : DbContext
{
public DoculinkDbContext(DbContextOptions options) : base(options)
{
}
public DbSet<Db.Doculink> Documents { get; set; }
public DbSet<Db.LinkType> LinkTypes { get; set; }
public DbSet<Db.DoculinkTranslation> DocumentsTranslations { get; set; }
public DbSet<Db.LinksTranslation> LinksTranslations { get; set; }
public DbSet<Db.DoculinkAttachments> DoclinksAttachments { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Doculink>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
modelBuilder.Entity<LinkType>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
modelBuilder.Entity<DoculinkTranslation>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
modelBuilder.Entity<LinksTranslation>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
modelBuilder.Entity<DoculinkAttachments>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
}
}
}