Debut Many to Many entre Champion et Runes 📦
continuous-integration/drone/push Build is failing Details

pull/32/head
Pierre Ferreira 2 years ago
parent 3a53d55ff4
commit 556260df84

@ -34,6 +34,11 @@ namespace EntityFramework
private ICollection<SkillEntity> Skills { get; set; }
// Pour le many to many Champion *<---->* RunePage
public ICollection<RunePageEntity> RunePageEntities{ get; set; }
public ChampionEntity(string name,string bio,string icon) {
this.Name = name;
this.Bio = bio;

@ -11,7 +11,7 @@ namespace EntityFramework
{
public DbSet<ChampionEntity> Champions { get; set; }
public DbSet<RuneEntity> Rune { get; set; }
public DbSet<RuneEntity> Rune { get; set; }
public DbSet<RunePageEntity> RunePage { get; set; }
@ -38,7 +38,7 @@ namespace EntityFramework
//modelBuilder.Entity<ChampionEntity>().Property(entity => entity.Id)
// .ValueGeneratedOnAdd();
modelBuilder.Entity<ChampionEntity>().Property(entity => entity.Name)
.IsRequired()
.HasMaxLength(50);
@ -50,7 +50,27 @@ namespace EntityFramework
modelBuilder.Entity<ChampionEntity>().Property(entity => entity.Icon)
.IsRequired();
// Many to Many ChampionEntity - RunePageEntity
modelBuilder.Entity<RunePageEntity>().HasKey(entity => entity.Name);
modelBuilder.Entity<RunePageEntity>().ToTable("RunePage");
// Use the shadow property as a foreign key
modelBuilder.Entity<RunePageEntity>()
.HasMany(r => r.Champion)
.WithMany(c => c.RunePageEntities);
//.HasForeignKey("AlbumForeignKey");
modelBuilder.Entity<ChampionEntity>()
.HasMany(c => c.RunePageEntities)
.WithMany(r => r.Champion);
//.HasForeignKey("AlbumForeignKey");
}
}
}

@ -16,8 +16,10 @@ namespace EntityFramework
public Rune? Rune { get; set; }
//? voir si cela pause probleme
Dictionary<EnumCategory, Rune> Dico = new Dictionary<EnumCategory, Rune>();
public Dictionary<EnumCategory, Rune> Dico = new Dictionary<EnumCategory, Rune>();
// Pour le many to many Champion *<---->* RunePage
public ICollection<ChampionEntity> Champion{ get; set; }

Loading…
Cancel
Save