using Microsoft.EntityFrameworkCore;
using OnProfNext.Server.Configurations;
using OnProfNext.Shared.Models;

namespace OnProfNext.Server.Data
{
    public class AppDbContext : DbContext
    {
        public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
        {
        }

        public DbSet<User> Users => Set<User>();

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            //Leitet aus UserConfiguration die Konfiguration der User-Entität ab
            modelBuilder.ApplyConfiguration(new UserConfiguration());
        }
    }
}
