I have two models, a Report:
public class Report
{
public int Id { get; set; }
public string Name { get; set; }
public virtual ChargeType ChargeTypes { get; set; }
}
public class ReportConfiguration : EntityConfiguration<Report>
{
public ReportConfiguration()
{
MapSingleType(r => new { r.Id, r.Name }).ToTable("Report");
HasMany(r => r.ChargeTypes)
.WithMany(c => c.Reports)
.Map("Report_ChargeType", (r,c) => new { ReportId = r.Id,
ChargeTypeId = c.Id });
}
}
and a ChargeType:
public class ChargeType
{
public int Id { get; set; }
public string Name { get; set; }
public int SortOrder { get; set; }
public virtual Report Reports { get; set; }
}
public class ChargeTypeConfiguration : EntityConfiguration<ChargeType>
{
public ReportConfiguration()
{
MapSingleType(c => new { c.Id, c.Name }).ToTable("ChargeType");
// map SortOrder property to join table "Report_ChargeType"
MapSingleType(c => c.SortOrder).ToTable("Report_ChargeType"); // doesn't work
}
}
I want to be able to map the SortOrder property of the ChargeType to the join table of Report and ChargeType. I have tried many things with no success, and I know there has to be some way to do it but I am at a loss. Hopefully someone else has some insight on how this could be done.