Open GertArnold opened 1 year ago
Note for triage: I am able to reproduce this; it appears to be an issue with client-side grouping as the final operator. Using AsEnumerable
before the GroupBy results in correct grouping.
SQL:
SELECT CONVERT(nvarchar(max), [t0].[Name]), [t0].[c]
FROM (
SELECT CONVERT(nvarchar(max), [t].[Name]) AS [c], [t].[Name]
FROM [Things] AS [t]
) AS [t0]
ORDER BY CONVERT(nvarchar(max), [t0].[Name])
SELECT [t].[Name]
FROM [Things] AS [t]
While investigating some other issue, I noticed that using
GroupBy
over a column converted byConvert.ToString()
creates only one group while multiple groups are expected.Code to reproduce (in Linqpad, using Microsoft.EntityFrameworkCore.SqlServer 7.0.5).
Query 1 returns a Group having
Thing 1
as Key and containing all items. It also has pretty convoluted generated SQL.Query 2 returns 3 groups as expected.