You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
System.InvalidOperationException: 'The LINQ expression 'x1 => new ViewEntryPlayerDto{
SteamId = x1.SteamPlayer.Id,
SteamName = x1.SteamPlayer.Name
}
' could not be translated. [...]
SELECT ROW_NUMBER() OVER(ORDER BY [e].[CattleMustered] DESC, [e].[TimeTaken]), [e].[Id], [t].[SteamId], [t].[SteamName], [t].[EntryId], [t].[PlayerNumber], [e].[TimeTaken], [e].[CattleMustered]
FROM [Entry1] AS [e]
LEFT JOIN (
SELECT [p].[Id] AS [SteamId], [p].[Name] AS [SteamName], [e0].[EntryId], [e0].[PlayerNumber]
FROM [EntryPlayer] AS [e0]
INNER JOIN [Players] AS [p] ON [e0].[SteamPlayerId] = [p].[Id]
) AS [t] ON [e].[Id] = [t].[EntryId]
ORDER BY ROW_NUMBER() OVER(ORDER BY [e].[CattleMustered] DESC, [e].[TimeTaken]), [e].[Id], [t].[EntryId], [t].[PlayerNumber]
For setup I have opt.AddWindowFunctionsSupport().AddCustomQueryableMethodTranslatingExpressionVisitorFactory()
The text was updated successfully, but these errors were encountered:
Alas, EF Core doesn't translate everything. The root cause why you get the InvalidOperationException is the same as with following query that has nothing to do with RowNumber nor AsSubQuery:
// Entity + Distinct + Use of NavProp is currently not supportedDbSet<Entry1>().Select(e =>new RankedEntry {Entry=e// <- "Entity" + ...}).Distinct()// <- ... + "Distinct" + ....Select(x =>new ViewEntryDto{Entry= x.Entry,Players= x.Entry.Players // <- ... + "Use of NavProp".Select(x1 =>new ViewEntryPlayerDto{SteamId= x1.SteamPlayer.Id,SteamName= x1.SteamPlayer.Name }).ToList()})
If EF Core translates query above in the future then most likely AsSubQuery will work as well.
To make the issue more obvious you can try the same query without projection of the players.
I'm getting the error:
Here is what the debug expression looks like:
and the wrong query without it:
For setup I have
opt.AddWindowFunctionsSupport().AddCustomQueryableMethodTranslatingExpressionVisitorFactory()
The text was updated successfully, but these errors were encountered: