Initial commit
This commit is contained in:
32
Data/ThuisDbContext.cs
Normal file
32
Data/ThuisDbContext.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
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"
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user