22 lines
553 B
C#
22 lines
553 B
C#
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using YPS.Beer.Models;
|
|
|
|
namespace YPS.Beer.Data;
|
|
|
|
public class BeerContext : IdentityDbContext<User>
|
|
{
|
|
public BeerContext(DbContextOptions<BeerContext> options) : base(options)
|
|
{
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder builder)
|
|
{
|
|
builder.Entity<User>()
|
|
.HasMany(u => u.Favourites)
|
|
.WithOne(f => f.User)
|
|
.HasForeignKey("UserId");
|
|
|
|
base.OnModelCreating(builder);
|
|
}
|
|
} |