using BrightGlimmer.Data.Interfaces; using BrightGlimmer.Domain; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Text; namespace BrightGlimmer.Data { public class BgContext : DbContext, IUnitOfWork { public BgContext(DbContextOptions options) : base(options) { } // dotnet ef migrations add NAME --project ./BrightGlimmer.Data --startup-project ./BrightGlimmer.Api // dotnet ef migrations update --project ./BrightGlimmer.Data --startup-project ./BrightGlimmer.Api protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity() .HasMany(x => x.Phones); modelBuilder.Entity() .HasOne(x => x.Address); modelBuilder.Entity() .HasMany(x => x.AssignedCourses); modelBuilder.Entity() .HasOne(x => x.Course); } public DbSet Students { get; set; } public DbSet Courses { get; set; } public DbSet AssignedCourses { get; set; } } }