using DTO; using Microsoft.EntityFrameworkCore; namespace EntityFramwork { public class BDDContext : DbContext { public BDDContext() { } public BDDContext(DbContextOptions option) : base(option) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); //création de la table Champion modelBuilder.Entity().HasKey(a => a.Id); modelBuilder.Entity().Property(a => a.Id) .ValueGeneratedOnAdd(); //création de la table Skins modelBuilder.Entity().HasKey(m => m.Id); modelBuilder.Entity().Property(m => m.Id) .ValueGeneratedOnAdd(); //modelBuilder.Entity().Property("ChampionForeignKey"); // Use the shadow property as a foreign key /* modelBuilder.Entity() .HasOne(m => m.Champion) .WithMany(a => a.Skins) .HasForeignKey("ChampionsForeignKey");*/ } public DbSet Champions { get; set; } public DbSet Skins { get; set; } public DbSet Images { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) { optionsBuilder.UseSqlite($"Data Source=C:\\Users\\Jolys Enzo\\home\\BUT\\Projet\\LOL-API\\Sources\\EntityFramwork\\BDD-APILOL.db"); } } } }