We have a recently introduced table (Organization_XREF) that contains two foreign key columns (Parent_ID
and Child_ID
) that both refer to the same primary key column (OrganizationID
) in the Organization table:
When we run EF Reverse POCO Code First Generator over this relationship, it generates the HasMany relationship in the Organization_Organization
Configuration class as follows:
HasMany(t => t.Organization_Organization).WithMany(t => t.Organization_Organization).Map(m =>
{
m.ToTable("Organization_XREF", schema);
m.MapLeftKey("ChildId");
m.MapRightKey("ParentId");
});
This code will not compile. The compiler is unable to infer the type of the argument to HasMany, likely because there is no Organization_Organization property generated for the Organization_Organization
model.
Has anyone else encountered a similar problem? How did you work around this? This is a critical issue for us, as it has broken our API.
As it turns out, this was a defect in the product. The tool's author (Simon Hughes) kindly contacted me to let me know the issue has been resolved in v2.10.0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With