Files
Thuis_api/Data/ThuisDbContext.cs
2023-01-30 09:20:18 +01:00

32 lines
789 B
C#

using Microsoft.EntityFrameworkCore;
using ThuisApi.Models;
namespace ThuisApi.Data;
public class ThuisDbContext : DbContext
{
public DbSet<Card> Cards { get; set; }
public DbSet<Freezer> Freezer { get; set; }
public DbSet<FreezerItem> FreezerItem { get; set; }
public ThuisDbContext(DbContextOptions<ThuisDbContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Freezer>().HasData(
new Freezer
{
FreezerId = 1,
Name = "Keuken"
},
new Freezer
{
FreezerId = 2,
Name = "Berging"
});
}
}