Skip to content

Commit 003fdda

Browse files
committed
EF6 - Cannot have a FK to a non-primary key. Thanks to Cédric Luthi.
1 parent 1038416 commit 003fdda

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

EntityFramework.Reverse.POCO.Generator/EF.Reverse.POCO.Core.ttinclude

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3271,6 +3271,10 @@ SELECT SERVERPROPERTY('Edition') AS Edition,
32713271
if (!pkCols.Any())
32723272
continue;
32733273

3274+
// EF6 - Cannot have a FK to a non-primary key
3275+
if (!pkCols.All(c => c.IsPrimaryKey))
3276+
continue;
3277+
32743278
var relationship = CalcRelationship(pkTable, fkTable, fkCols.Select(c => c.col).ToList(), pkCols);
32753279
if (relationship == Relationship.DoNotUse)
32763280
continue;

0 commit comments

Comments
 (0)