33 lines
904 B
C#
33 lines
904 B
C#
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();
|
|
}
|
|
}
|
|
}
|