Looking forward to using Include requires that the data form does not change since Include is applied. In your case, this means the query should return an IQueryable<BrokerPayments> . But the GroupBy operator changes shape because it returns IQueryable<IGrouping<TKey, TSource>> . The same thing will happen with projections and user associations.
As a workaround, you can group in LINQ with objects such as:
var brokerPaymentLists = dbContext.BrokerPayments .Include("PaymentDetail") .Where(bp => bp.IdPaymentStatus == (long)EntityModel.Additions.Variables.PaymentStatus.ALLOTED) .AsEnumerable() .GroupBy(bp => bp.IdBroker, (key, g) => new { IdBroker = key.Value, BrokerPayments = g });
NOTE. Please note that exectuion request will not be a deferder
source share