Skip to content

Commit

Permalink
Migrations: Order unmapped base class properties last
Browse files Browse the repository at this point in the history
Fixes #11314
  • Loading branch information
bricelam committed Aug 11, 2020
1 parent 2bdf741 commit 05668ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -827,9 +827,10 @@ private static IEnumerable<IProperty> GetSortedProperties(IEntityType entityType
.Select(pi => primaryKeyPropertyGroups.ContainsKey(pi) ? primaryKeyPropertyGroups[pi] : null)
.Where(e => e != null)
.Concat(leastPriorityPrimaryKeyProperties)
.Concat(sortedPropertyInfos.Where(pi => !primaryKeyPropertyGroups.ContainsKey(pi)).SelectMany(p => groups[p]))
.Concat(sortedPropertyInfos.Where(pi => !primaryKeyPropertyGroups.ContainsKey(pi) && entityType.ClrType.IsAssignableFrom(pi.DeclaringType)).SelectMany(p => groups[p]))
.Concat(leastPriorityProperties)
.Concat(entityType.GetDirectlyDerivedTypes().SelectMany(et => GetSortedProperties(et, table)));
.Concat(entityType.GetDirectlyDerivedTypes().SelectMany(et => GetSortedProperties(et, table)))
.Concat(sortedPropertyInfos.Where(pi => !primaryKeyPropertyGroups.ContainsKey(pi) && !entityType.ClrType.IsAssignableFrom(pi.DeclaringType)).SelectMany(p => groups[p]));
}

private sealed class PropertyInfoEqualityComparer : IEqualityComparer<PropertyInfo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9619,10 +9619,10 @@ var dependentTableCreation
c => Assert.Equal("Id2", c.Name),
c => Assert.Equal("Id1", c.Name),
c => Assert.Equal("ShadowPk", c.Name),
c => Assert.Equal("RealFkNavigationId", c.Name),
c => Assert.Equal("ShadowFkNavigationId", c.Name),
c => Assert.Equal("Value", c.Name),
c => Assert.Equal("AnotherShadowProperty", c.Name));
c => Assert.Equal("AnotherShadowProperty", c.Name),
c => Assert.Equal("RealFkNavigationId", c.Name),
c => Assert.Equal("ShadowFkNavigationId", c.Name));
});
}

Expand Down

0 comments on commit 05668ce

Please sign in to comment.