Vidarls/Simple.Data.Mysql — Issue #5: Foreign key discovery
Author: richardhopton
Created: 2011-11-24 23:34:16+00:00
State: open

The convention based foreign key discovery process is great but there are a few tweaks that might round it off properly.

1, Support keys as follows:-

OrderItems.OrderId => Orders.Id

This is matching the singular of the master table name + PK fieldname to the fieldname in the detail table.

2, If you support point 1 you'll need to make sure it doesn't match PK from the detail table to fields on the master tables as there may be multiple tables with the same field name (Id in this case) which are completely unrelated. For instance OrderItems.Id & Orders.Id are not related.