I have an entity that has a relation using the FK ProductId, I then have another relation on the same entity using the composite keys ProductId and VehicleId. This does not work. I get
One or more validation errors were detected during model generation:
ProductId: Name: Each property name in a type must be unique. Property name 'ProductId' is already defined.
Config code
public class BookingConfiguration : EntityTypeConfiguration<Booking>
{
public BookingConfiguration()
{
...
HasRequired(b => b.Product)
.WithMany(p => p.Bookings)
.Map(m =>
{
m.MapKey("ProductId");
});
HasRequired(b => b.Vehicle)
.WithMany(v => v.Bookings)
.Map(m =>
{
m.MapKey("ProductId","VehicleId");
});
}
}