Hi,
I followed the example in Blazor DataGrid Component with IQueryable and Line 34 "IEnumerable employees;" got my attention.
If I use this in my simple App with an EF Core backend, I find the following in the EF log:
RelationalEventId.CommandExecuted[20101] (Microsoft.EntityFrameworkCore.Database.Command)
Executed DbCommand (30ms) [Parameters=, CommandType='Text', CommandTimeout='30']
SELECT [e]....
FROM [Exports] AS [e]
INNER JOIN [Spaces] AS [s] ON [e].[SpaceId] = [s].[Id]
LEFT JOIN [Headers] AS [h] ON [e].[HeaderId] = [h].[Id]
Whereas when I change the type of the variable to IQueryable, I got this:
RelationalEventId.CommandExecuted[20101] (Microsoft.EntityFrameworkCore.Database.Command)
Executed DbCommand (4ms) [Parameters=, CommandType='Text', CommandTimeout='30']
SELECT TOP(1) [e]....
FROM [Exports] AS [e]
INNER JOIN [Spaces] AS [s] ON [e].[SpaceId] = [s].[Id]
LEFT JOIN [Headers] AS [h] ON [e].[HeaderId] = [h].[Id]
So although the underlying Object doesn't change,
System.Linq.IQueryable<....Export> {Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.IncludableQueryable<....Export, ....Header>}
System.Collections.Generic.IEnumerable<....Export> {Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.IncludableQueryable<....Export, ....Header>}
the behaviour does.
I'm still a little confused about the why, but shouldn't the example be changed?