Thank you for the additional details.
The reason for the error is that the foreign key constraint between the two classes is missing in the model. The solution is to modify a bit PrepareAdresAssociationConfigurations() using the HasConstraint()
method. Without this enhancement Data Access is unable to resolve which of the Adres properties is the foreign key. Thus it defaults to Default Mapping
and adds in the metadata model the Id2 column as a foreign key property.
The PrepareAdresAssociationConfigurations() method should look like this:
configuration.HasAssociation(x => x.Person)
.WithOpposite(x => x.Adres)
.HasConstraint((x, y) => x.PersonId == y.Id)
The conversion between the .rlinq file and the fluent model did not generated it for two reasons:
- it was not defined in the .rlinq file
- the persistent classes were not mapped to tables in .rlinq file.
I hope this helps.
Telerik by Progress
Check out the latest announcement
about Telerik Data Access vNext as a powerful framework
able to solve core development problems.