Skip to content

Commit 82c8ad5

Browse files
committed
fix(#107): EF bug
tracking: dotnet/efcore#8462
1 parent f8a1e56 commit 82c8ad5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/JsonApiDotNetCore/Data/DefaultEntityRepository.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,12 @@ public virtual async Task<TEntity> GetAsync(TId id)
8585

8686
public virtual async Task<TEntity> GetAndIncludeAsync(TId id, string relationshipName)
8787
{
88-
return await Get()
88+
var result = await Get()
8989
.Include(relationshipName)
90-
.SingleOrDefaultAsync(e => e.Id.Equals(id));
90+
.Where(e => e.Id.Equals(id))
91+
.ToListAsync();
92+
93+
return result.SingleOrDefault();
9194
}
9295

9396
public virtual async Task<TEntity> CreateAsync(TEntity entity)

0 commit comments

Comments
 (0)