Skip to content

Commit

Permalink
Simplify list creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcvickers committed Aug 17, 2023
1 parent 68bc8e9 commit 0d5d55d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 54 deletions.
22 changes: 4 additions & 18 deletions src/EFCore/Metadata/Internal/TypeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1359,27 +1359,13 @@ public virtual IEnumerable<PropertyBase> GetSnapshottableMembers()
yield return property;
}

foreach (var property in ReturnComplexProperties(GetComplexProperties()))
foreach (var complexProperty in GetComplexProperties())
{
yield return property;
}
yield return complexProperty;

static IEnumerable<PropertyBase> ReturnComplexProperties(IEnumerable<ComplexProperty> complexProperties)
{
foreach (var complexProperty in complexProperties)
foreach (var propertyBase in complexProperty.ComplexType.GetSnapshottableMembers())
{
yield return complexProperty;

var complexType = complexProperty.ComplexType;
foreach (var property in ((IComplexType)complexType).GetProperties())
{
yield return (PropertyBase)property;
}

foreach (var property in ReturnComplexProperties(complexType.GetComplexProperties()))
{
yield return property;
}
yield return propertyBase;
}
}
}
Expand Down
22 changes: 4 additions & 18 deletions src/EFCore/Metadata/RuntimeComplexType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,27 +156,13 @@ static IEnumerable<RuntimePropertyBase> Create(RuntimeComplexType type)
yield return property;
}

foreach (var property in ReturnComplexProperties(type.GetComplexProperties()))
foreach (var complexProperty in type.GetComplexProperties())
{
yield return property;
}
yield return complexProperty;

static IEnumerable<RuntimePropertyBase> ReturnComplexProperties(IEnumerable<RuntimeComplexProperty> complexProperties)
{
foreach (var complexProperty in complexProperties)
foreach (var propertyBase in complexProperty.ComplexType.GetSnapshottableMembers())
{
yield return complexProperty;

var complexType = complexProperty.ComplexType;
foreach (var property in ((IComplexType)complexType).GetProperties())
{
yield return (RuntimePropertyBase)property;
}

foreach (var property in ReturnComplexProperties(complexType.GetComplexProperties()))
{
yield return property;
}
yield return propertyBase;
}
}
}
Expand Down
22 changes: 4 additions & 18 deletions src/EFCore/Metadata/RuntimeEntityType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -816,27 +816,13 @@ static IEnumerable<RuntimePropertyBase> Create(RuntimeEntityType type)
yield return property;
}

foreach (var property in ReturnComplexProperties(type.GetComplexProperties()))
foreach (var complexProperty in type.GetComplexProperties())
{
yield return property;
}
yield return complexProperty;

static IEnumerable<RuntimePropertyBase> ReturnComplexProperties(IEnumerable<RuntimeComplexProperty> complexProperties)
{
foreach (var complexProperty in complexProperties)
foreach (var property in complexProperty.ComplexType.GetSnapshottableMembers())
{
yield return complexProperty;

var complexType = complexProperty.ComplexType;
foreach (var property in ((IComplexType)complexType).GetProperties())
{
yield return (RuntimePropertyBase)property;
}

foreach (var property in ReturnComplexProperties(complexType.GetComplexProperties()))
{
yield return property;
}
yield return property;
}
}

Expand Down

0 comments on commit 0d5d55d

Please sign in to comment.