Hi
I am trying to map modela to modelb i have a model ab table, and I have fluent api setup in a different class using IEntityTypeConfiguration
my code looks like
public class ABModelConfiguration : IEntityTypeConfiguration<ABModel>
{
public void Configure(EntityTypeBuilder<ABModel> builder)
{
builder.HasKey(ra => new { ra.AId, ra.BId});
builder.HasOne(ra => ra.AModel)
.WithMany(rt => rt.AModels)
.HasForeignKey(ra => ra.AId);
builder.HasOne(ra => ra.BModel)
.WithMany(rt => rt.BModels)
.HasForeignKey(ra => ra.BId);
}
}howeve under the BModels and AModels in the .WithManyStatement i have a red squigally line saying it cannot convert ICollection To IEnumerable
in the ABModel they are list as single models eg public AModel {get;set;} in the A and B Model they are public ICollection<ABModel> ABModels {get;set;}
I am using .net EF 2.1, and i can't find the answer, any suggestions would be appriciated.