Files
Seasoned/Seasoned.Backend/Data/ApplicationDbContext.cs
2026-03-15 22:51:26 +00:00

26 lines
748 B
C#

using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Seasoned.Backend.Models;
namespace Seasoned.Backend.Data;
public class ApplicationDbContext : IdentityDbContext<IdentityUser>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options) { }
public DbSet<Recipe> Recipes { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.HasPostgresExtension("vector");
modelBuilder.Entity<Recipe>()
.HasOne<IdentityUser>()
.WithMany()
.HasForeignKey(r => r.UserId);
}
}