@@ -71,32 +71,17 @@ private static Result GetForeignKeyPropertyInfosCore(Type sourceType, Type targe
7171 return null ;
7272 }
7373
74- // if left is null, its probably because there is no bi-directional nav properties in both types
75- PropertyInfo [ ] leftKeysToJoinOn = null ;
7674 var leftNavPi = foundInSource ? adjacentNavPropertyInfo : foreignNavPropertyInfo ;
77- if ( leftNavPi != null )
78- {
79- var leftPiType = leftNavPi . PropertyType . GetGenericTypeOrDefault ( ) ;
80- leftKeysToJoinOn = foundInSource
81- ? foreignKeyPropertyInfos
82- : PrimaryKeyConventionHelper . GetPrimaryKeyPropertyInfos ( leftPiType ) ;
83- }
75+ var leftKeysToJoinOn = foundInSource
76+ ? foreignKeyPropertyInfos
77+ : PrimaryKeyConventionHelper . GetPrimaryKeyPropertyInfos (
78+ leftNavPi . PropertyType . GetGenericTypeOrDefault ( ) ) ;
8479
85- PropertyInfo [ ] rightKeysToJoinOn = null ;
8680 var rightNavPi = foundInSource ? foreignNavPropertyInfo : adjacentNavPropertyInfo ;
87- if ( rightNavPi != null )
88- {
89- var rightPiType = rightNavPi . PropertyType . GetGenericTypeOrDefault ( ) ;
90- rightKeysToJoinOn = foundInSource
91- ? PrimaryKeyConventionHelper . GetPrimaryKeyPropertyInfos ( rightPiType )
92- : foreignKeyPropertyInfos ;
93- }
94- // might be doing a backgward tarversal, which is the only reason why
95- // left might have something but the right side wont
96- else if ( leftNavPi != null )
97- {
98- rightKeysToJoinOn = foreignKeyPropertyInfos ;
99- }
81+ var rightKeysToJoinOn = foundInSource
82+ ? PrimaryKeyConventionHelper . GetPrimaryKeyPropertyInfos (
83+ rightNavPi . PropertyType . GetGenericTypeOrDefault ( ) )
84+ : foreignKeyPropertyInfos ;
10085
10186 return new Result ( leftNavPi , leftKeysToJoinOn , rightNavPi , rightKeysToJoinOn ) ;
10287 }
0 commit comments