Microsoft.EntityFrameworkCore.Proxies
virtual
modelBuilder.Entity<Mod>().HasIndex(it => it.Slug).IsUnique(); modelBuilder.Entity<Mod>().HasOne(it => it.Meta).WithOne(it => it.Mod).HasForeignKey<ModMetadata>(it => it.ModId); modelBuilder.Entity<Mod>().HasMany(it => it.PlatformIDs).WithOne(it => it.Mod).HasForeignKey(it => it.ModId); modelBuilder.Entity<ModSupportedPlatform>().HasOne(it => it.Platform).WithMany().HasForeignKey(it => it.PlatformId).IsRequired(); modelBuilder.Entity<ModSupportedPlatform>().HasKey(it => new {it.PlatformId, it.PlatformKey});
[Table("mods")]public class Mod : BaseModel{ public string Slug { get; set; } = null!; public ModMetadata Meta { get; set; } = null!; public ICollection<ModSupportedPlatform> PlatformIDs { get; set; } = new List<ModSupportedPlatform>(); public ICollection<McVersion> SupportedVersions { get; set; } = new List<McVersion>(); [GraphField("supportedPlatforms")] public IEnumerable<Platform> GetSupportedPlatforms() { return PlatformIDs.Select(it => it.Platform).AsEnumerable(); }}