using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using ZpcBulletinBoard.Models; using ZpcBulletinBoard.Models.Editor; namespace ZpcBulletinBoard.Data { public class ApplicationDbContext(DbContextOptions options) : IdentityDbContext(options) { public DbSet Notes { get; set; } public DbSet BulletinBoards { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); //Relacije modelBuilder.Entity() .HasMany(t => t.Notes) .WithOne(t => t.BulletinBoard) .OnDelete(DeleteBehavior.Cascade); } } }