Estou tentando executar o seguinte código no console:
 using (var context = new AluraTunesContext())
            {
                var query = from nf in context.ItemNotaFiscals
                            where nf.Faixa.Album.Artista.Nome == "Led Zeppelin"
                            group nf by nf.Faixa.Album.Titulo
                                into agrupado
                            let total = agrupado.Sum(g => g.Quantidade * g.PrecoUnitario)
                            orderby total
                                descending
                            select new
                            {
                                Album = agrupado.Key,
                                Quantidade = agrupado.Sum(g => g.Quantidade),
                                Preco = total
                            };
                foreach (var nf in query)
                {
                    Console.WriteLine("{0}\t{1}\t{2}", nf.Album.PadRight(40), nf.Quantidade, nf.Preco);
                }
            }Estou utilizando .Net5 EF core, quando executo da o seguinte erro:
System.InvalidOperationException: 'Processing of the LINQ expression 'GroupByShaperExpression:
KeySelector: a.Titulo, 
ElementSelector:EntityShaperExpression: 
    EntityType: ItemNotaFiscal
    ValueBufferExpression: 
        ProjectionBindingExpression: EmptyProjectionMember
    IsNullable: False
' by 'RelationalProjectionBindingExpressionVisitor' failed. This may indicate either a bug or a limitation in Entity Framework. See https://go.microsoft.com/fwlink/?linkid=2101433 for more detailed information.'
Se executo a mesma consulta sem o LET funciona, como segue:
using (var context = new AluraTunesContext())
            {
                var query = from nf in context.ItemNotaFiscals
                            where nf.Faixa.Album.Artista.Nome == "Led Zeppelin"
                            group nf by nf.Faixa.Album.Titulo
                                into agrupado
                            orderby agrupado.Sum(g => g.Quantidade * g.PrecoUnitario)
                                descending
                            select new
                            {
                                Album = agrupado.Key,
                                Quantidade = agrupado.Sum(g => g.Quantidade),
                                Preco = agrupado.Sum(g => g.Quantidade * g.PrecoUnitario)
                            };
                foreach (var nf in query)
                {
                    Console.WriteLine("{0}\t{1}\t{2}", nf.Album.PadRight(40), nf.Quantidade, nf.Preco);
                }
            }