This commit is contained in:
David Štaleker
2024-02-25 20:09:43 +01:00
parent 28d1630749
commit 4df426dc10
614 changed files with 121469 additions and 7647 deletions

View File

@@ -0,0 +1,30 @@
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<ApplicationDbContext> options)
: IdentityDbContext<IdentityApplicationUser, IdentityApplicationRole, int>(options)
{
public DbSet<Note> Notes { get; set; }
public DbSet<BulletinBoard> BulletinBoards { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
//Relacije
modelBuilder.Entity<BulletinBoard>()
.HasMany(t => t.Notes)
.WithOne(t => t.BulletinBoard)
.OnDelete(DeleteBehavior.Cascade);
}
}
}