Added database models

This commit is contained in:
2025-01-20 17:43:05 +01:00
parent 00504ad485
commit 49b5339bb3
11 changed files with 242 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore;
using Portfolio.Shared.Models;
namespace Portfolio.Api;
public class DatabaseContext(DbContextOptions<DatabaseContext> options) : DbContext(options) {
public DbSet<Project> Projects { get; set; }
public DbSet<Language> Languages { get; set; }
public DbSet<Technology> Technologies { get; set; }
public DbSet<TimelineEntry> Timeline { get; set; }
public DbSet<About> About { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder) {
modelBuilder.Entity<Project>()
.HasMany(p => p.Languages)
.WithMany()
.UsingEntity("ProjectLanguage");
}
}