Search code examples
.netentity-frameworkentity-framework-4navigation-properties

EF 4 Navigation Properties Question


Suppose I had TableA with 2 relationship references to TableB, where TableB is the primary key (let's say it has a PrimaryBKey and SecondaryBKey columns as the FK names in TableA). So I have entity:

TableA
    public TableB TableB { .. } 
    public TableB TableB1 { .. } 

Is there any documentation on how EF derives the naming scheme, and can it change? I have developers telling me that when they regen a table, it's changing the ordering of relationships. What I mean by that is that originally the entity was mapped in this way:

PrimaryBKey = TableB1
SecondaryBKey = TableB

But they said that it was switched later on to:

PrimaryBKey = TableB
SecondaryBKey = TableB1

Is that even possible? I can't quite find any documentation on the naming scheme to verify this.

Thanks.


Solution

  • These three documents will have what you are looking for, specifically the first two: