In practice, the GROUP BY clause is often used with aggregate functions. Our basic entities do not have properties for them. A dedicated type is needed.
The simplest way is to declare a class that references the related entities and adds missing properties:
}In EF such types are called Keyless Entity Types and they must be mapped as keyless:
modelBuilder.Entity<CustomerYearOrders>(entity => entity.HasNoKey());Then we can introduce a dedicated DbSet<> property in the context or use ad-hoc context.Set<>() method.
The next few examples in the tutorial do permutations with already covered features. Except the last which has a cool SUM expression: