Skip to content

Commit

Permalink
Fix code reference (#4872)
Browse files Browse the repository at this point in the history
Fixes #4871
  • Loading branch information
roji authored Nov 12, 2024
1 parent fed9c42 commit fccb854
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions samples/core/Miscellaneous/NewInEFCore9/QuerySample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,17 @@ async Task<List<Post>> GetPostsForceConstantCollection(int[] ids)
Console.WriteLine();
Console.WriteLine("Aggregate over subquery/aggregate:");
Console.WriteLine();
// </AggregateOverSubquery>
var latestPostsAverageRatingByLanguage = await context.Blogs.
Select(x => new
#region AggregateOverSubquery
var latestPostsAverageRatingByLanguage = await context.Blogs
.Select(x => new
{
x.Language,
LatestPostRating = x.Posts.OrderByDescending(xx => xx.PublishedOn).FirstOrDefault().Rating
LatestPostRating = x.Posts.OrderByDescending(xx => xx.PublishedOn).FirstOrDefault()!.Rating
})
.GroupBy(x => x.Language)
.Select(x => x.Average(xx => xx.LatestPostRating))
.ToListAsync();
// </AggregateOverSubquery>
#endregion

// Max over decimal is not supported on Sqlite
if (!context.UseSqlite)
Expand Down

0 comments on commit fccb854

Please sign in to comment.