30 lines
959 B
C#
30 lines
959 B
C#
using Hospitality.Domain.Entities;
|
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Hospitality.Infrastructure.Data;
|
|
|
|
public class HospitalityDbContext : IdentityDbContext<ApplicationUser>
|
|
{
|
|
public HospitalityDbContext(DbContextOptions<HospitalityDbContext> options) : base(options)
|
|
{
|
|
}
|
|
|
|
public DbSet<Event> Events { get; set; }
|
|
public DbSet<Product> Products { get; set; }
|
|
public DbSet<QuotaDefinition> QuotaDefinitions { get; set; }
|
|
public DbSet<Group> Groups { get; set; }
|
|
public DbSet<Person> People { get; set; }
|
|
public DbSet<PersonQuota> PersonQuotas { get; set; }
|
|
public DbSet<Transaction> Transactions { get; set; }
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
|
|
modelBuilder.Entity<Person>()
|
|
.HasIndex(p => p.QrCode)
|
|
.IsUnique();
|
|
}
|
|
}
|