DamageAssessment_Backend/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Db/UsersAccessDbContext.cs

33 lines
904 B
C#
Raw Permalink Normal View History

using Microsoft.EntityFrameworkCore;
namespace DamageAssesment.Api.UsersAccess.Db
{
public class UsersAccessDbContext : DbContext
{
public DbSet<Db.User> Users { get; set; }
public DbSet<Db.Role> Roles { get; set; }
public DbSet<Db.Token> Tokens { get; set; }
public UsersAccessDbContext(DbContextOptions options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<User>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
modelBuilder.Entity<Role>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
modelBuilder.Entity<Token>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
}
}
}