Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Query: Set reference navigation loaded when referenced entity is null…
Browse files Browse the repository at this point in the history
… in tracking query

Resolves #15949
smitpatel committed Jun 6, 2019
1 parent 9e0fb47 commit 5699a01
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -46,7 +46,15 @@ private static void IncludeReference<TEntity, TIncludedEntity>(
{
var relatedEntity = innerShaper(queryContext, dbDataReader, resultCoordinator);

if (!trackingQuery)
if (trackingQuery)
{
// For non-null relatedEntity StateManager will set the flag
if (ReferenceEquals(relatedEntity, null))
{
queryContext.StateManager.TryGetEntry(entity).SetIsLoaded(navigation);
}
}
else
{
SetIsLoadedNoTracking(entity, navigation);
if (!ReferenceEquals(relatedEntity, null))
2 changes: 1 addition & 1 deletion test/EFCore.Specification.Tests/Query/IncludeTestBase.cs
Original file line number Diff line number Diff line change
@@ -4099,7 +4099,7 @@ public virtual async Task Include_empty_collection_sets_IsLoaded(bool useString,
}
}

[ConditionalTheory(Skip = "#15949")]
[ConditionalTheory]
[InlineData(false, false)]
[InlineData(true, false)]
public virtual async Task Include_empty_reference_sets_IsLoaded(bool useString, bool async)

0 comments on commit 5699a01

Please sign in to comment.