25 lines
686 B
C#
25 lines
686 B
C#
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("LanguageProject");
|
|
}
|
|
|
|
} |