summaryrefslogtreecommitdiffstats
path: root/src/Data/AppDbContext.cs
blob: 34aad0052ece7f8a5c85711d9d90ba9968aba285 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using IOL.Fagprove.Data.Models;
using Microsoft.EntityFrameworkCore;

namespace IOL.Fagprove.Data
{
    public class AppDbContext : DbContext
    {
        public AppDbContext(DbContextOptions options) : base(options)
        {
        }
        public DbSet<User> Users { get; set; }
        public DbSet<Reservation> Reservations { get; set; }
        public DbSet<ReservationObject> Cabins { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
#if DEBUG
            modelBuilder.ApplyConfiguration(new Seed.SeedUsers());
#endif
            modelBuilder.Entity<User>().ToTable("Users");
            modelBuilder.Entity<Reservation>().ToTable("Reservations");
            modelBuilder.Entity<ReservationObject>().ToTable("Cabins");
            base.OnModelCreating(modelBuilder);
        }
    }
}