31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
using Microsoft.AspNetCore.Identity;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace DamageAssesment.Api.Documents.Db
|
|
{
|
|
public class DocumentDbContext : DbContext
|
|
{
|
|
public DocumentDbContext(DbContextOptions options) : base(options)
|
|
{
|
|
}
|
|
public DbSet<Db.Document> Documents { get; set; }
|
|
public DbSet<Db.LinkType> LinkTypes { get; set; }
|
|
public DbSet<Db.DocumentsTranslation> DocumentsTranslations { get; set; }
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
modelBuilder.Entity<Document>()
|
|
.Property(item => item.Id)
|
|
.ValueGeneratedOnAdd();
|
|
modelBuilder.Entity<LinkType>()
|
|
.Property(item => item.Id)
|
|
.ValueGeneratedOnAdd();
|
|
modelBuilder.Entity<DocumentsTranslation>()
|
|
.Property(item => item.Id)
|
|
.ValueGeneratedOnAdd();
|
|
}
|
|
}
|
|
}
|