实际上有什么区别: this.HasRequired(a => a.Something) .WithMany() .Map(a => a.MapKey("SomethingId")); 和 this.HasRequired(a => a.Something) .WithMany() .HasForeignKey(a => a.SomethingId);
我有两个POCO课程 public class Order { int id; string code; int? quotationId; //it is foreign key public int Id{get;set;} public string Code{get;set;} public int? QuotationId{get;set;} Quotation quotation; public virtual Quotation Quotation { get; set; } …. } public class Quotation { int Id; string Code; public int Id{get;set;} public string Code{get;set;} Order order; public virtual Order […]