0 points

ApplicationDbContext


dashboard

Tue Sep 29 2020 14:48:50 GMT+0000 (UTC)

Posted by @JOMOGO #c#

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using GoodTimes.Models;

namespace GoodTimes.Data
{
    public class ApplicationDbContext : IdentityDbContext
    {
        public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
            : base(options)
        {
        }
        public DbSet<GoodTimes.Models.Reserveren> Reserveren { get; set; }
        public DbSet<GoodTimes.Models.Menukaart> Menukaart { get; set; }
        public DbSet<GoodTimes.Models.Categorie> Categorie { get; set; }
        public DbSet<GoodTimes.Models.Product> Product { get; set; }

        protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);
            builder.Entity<Menukaart>().HasData(
                new Menukaart
                {
                    Id = 1,
                    Naam = "Lunchkaart"
                },
                new Menukaart
                {
                    Id = 2,
                    Naam = "Dinerkaart"
                },
                new Menukaart
                {
                    Id = 3,
                    Naam = "Drankenkaart"
                }
            );
        }

        public DbSet<GoodTimes.Models.Bestelling> Bestelling { get; set; }

        //public DbSet<GoodTimes.Models.Bon> Bon { get; set; }

        //public DbSet<GoodTimes.Models.BonRegel> BonRegel { get; set; }
    }
}
content_copy Copy