public class A { public int ID{get;set;} public string Name{get;set;} public List< B> BList{get;set;} } public class B { public int ID{get;set;} public int AID{get;set;} public string Name{get;set;} public A AObject{get;set;} } public class AMap:EntityTypeConfiguration<A> { public AMap() { this.ToTable("ATable"); this.HasKey(x => x.ID); } } public class BMap:EntityTypeConfiguration< B> { public BMap() { this.ToTable("BTable"); this.HasKey(x => x.ID); this.Property(x => x.AID).IsRequired(); this.HasRequired(x => x.AObject).WithMany(x => x.BList).HasForeignKey(x => x.AID); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)