Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/EFCore/ChangeTracking/ComplexElementEntry`.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public virtual ComplexPropertyEntry<TEntity, TNestedComplexProperty> ComplexProp
/// </param>
/// <returns>An object that exposes change tracking information and operations for the given property.</returns>
public virtual ComplexCollectionEntry<TEntity, TElement> ComplexCollection<TElement>(
Expression<Func<TEntity, IEnumerable<TElement>?>> propertyExpression)
Expression<Func<TComplexProperty, IEnumerable<TElement>?>> propertyExpression)
where TElement : notnull
{
Check.NotNull(propertyExpression, nameof(propertyExpression));
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore/ChangeTracking/ComplexPropertyEntry`.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public virtual ComplexPropertyEntry<TEntity, TNestedComplexProperty> ComplexProp
/// </param>
/// <returns>An object that exposes change tracking information and operations for the given property.</returns>
public virtual ComplexCollectionEntry<TEntity, TElement> ComplexCollection<TElement>(
Expression<Func<TEntity, IEnumerable<TElement>?>> propertyExpression)
Expression<Func<TComplexProperty, IEnumerable<TElement>?>> propertyExpression)
where TElement : notnull
{
Check.NotNull(propertyExpression, nameof(propertyExpression));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ public void DetectChanges_detects_changes_in_nested_complex_collections()
{
Items =
[
new NestedItem { Name = "bar" },
new NestedItem { Name = "bar1" },
new NestedItem { Name = "baz" },
new NestedItem { Name = "new-bar" }
]
Expand All @@ -717,6 +717,13 @@ public void DetectChanges_detects_changes_in_nested_complex_collections()
changeDetector.DetectChanges(stateManager);

Assert.Equal(EntityState.Modified, entityEntry.EntityState);

var nestedJson = new EntityEntry<BlogWithNested>(entityEntry).ComplexProperty(b => b.NestedJson);
var items = nestedJson.ComplexCollection(j => j.Items);
Assert.Equal(3, items.CurrentValue!.Count);
Assert.Equal(EntityState.Modified, items[0].State);
Assert.Equal(EntityState.Unchanged, items[1].State);
Assert.Equal(EntityState.Added, items[2].State);
}

private static IModel CreateModel()
Expand Down