We're trying to write a LINQ query against LightSpeed IQueryables. In the query, we're trying to include a subquery with a group by.
Here's a an example of what we're trying to do:
(from p in QEntity<Model.Prd>.GetAll
join pd in QEntity<Model.PrdDst>.GetAll on p.Id equals pd.PrdId
join d in QEntity<Model.Dst>.GetAll on pd.DstId equals d.Id
join pdu in QEntity<Model.PrdDstUM>.GetAll on pd.Id equals pdu.PrdDstId
join UM in QEntity<Model.UM>.GetAll on pdu.OrderUMId equals UM.Id
join pcdu in QEntity<Model.PrdCpDstUM>.GetAll on pdu.Id equals pcdu.PrdDstUMId
join pcu in QEntity<Model.PrdCpUM>.GetAll on pcdu.PrdCpUMId equals pcu.Id
join pc in QEntity<Model.PrdCp>.GetAll on pcu.PrdCpId equals pc.Id
join c in QEntity<Model.Cp>.GetAll on pc.CpId equals c.Id
join vndrCt in
(
from vndrCt in QEntity<Model.LocvndrCtMv>.GetAll
group vndrCt by vndrCt.VcNumber into vndrCtGroup
select new
{
vndrCtNumber = vndrCtGroup.Key,
vndrCtCount = vndrCtGroup.Count()
}
) on d.CtNumber equals vndrCt.vndrCtNumber
orderby d.Name, pdu.OrderUM.Description
where p.Id == PrdId
select new DstCpDto
{
CpCode = c.Code,
DstCtName = d.Name,
DstCtNumber = d.CtNumber,
OrdUM = UM.Description,
Sb = pcdu.IsSb == true ? "Y" : "N",
EItem = pcdu.IsAll != false ? "A" : "E",
CtStartDate = pcdu.StartDate,
CtEndDate = pcdu.EndDate,
Status = pcdu.EndDate < DateTime.Today || !pcdu.StartDate.HasValue ? PrdCpDstUMStatus.Inactive : PrdCpDstUMStatus.ReadyFor
})
QEntity returns a LightSpeed IQueryable. Everything works fine without the subquery. We add the subquery which contains the group by and get the following error:
System.NotSupportedException: Specified method is not supported. at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ExtractMemberCriteria(LinqQueryPlanExpression plan, MemberExpression member) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ConvertToQueryExpression(LinqQueryPlanExpression plan, Expression expression) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ConvertToQueryExpression(LinqQueryPlanExpression plan, Expression expression) at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ConvertToQueryExpression(LinqQueryPlanExpression plan, Expression expression) at Mindscape.LightSpeed.Linq.Sqo.Join.ExtractJoinCriteria(LinqQueryPlanExpression plan, Expression expression) at Mindscape.LightSpeed.Linq.Sqo.Join.ExtractJoinConditions(LinqQueryPlanExpression plan, Expression lhsCriteriaExpression, Expression rhsCriteriaExpression, Selectable rhsSelectable) at Mindscape.LightSpeed.Linq.Sqo.Join.Evaluate(ExpressionVisitor visitor, MethodCallExpression expression) at Mindscape.LightSpeed.Linq.Plan.LinqQueryBuilder.VisitMethodCall(MethodCallExpression exp) at Mindscape.LightSpeed.Linq.Plan.LinqQueryBuilder.Visit(Expression exp) at Mindscape.LightSpeed.Linq.Sqo.OrderSqo.Evaluate(ExpressionVisitor visitor, MethodCallExpression expression) at Mindscape.LightSpeed.Linq.Plan.LinqQueryBuilder.VisitMethodCall(MethodCallExpression exp) at Mindscape.LightSpeed.Linq.Plan.LinqQueryBuilder.Visit(Expression exp) at Mindscape.LightSpeed.Linq.Sqo.OrderSqo.Evaluate(ExpressionVisitor visitor, MethodCallExpression expression) at Mindscape.LightSpeed.Linq.Plan.LinqQueryBuilder.VisitMethodCall(MethodCallExpression exp) at Mindscape.LightSpeed.Linq.Plan.LinqQueryBuilder.Visit(Expression exp) at Mindscape.LightSpeed.Linq.Sqo.Where.Evaluate(ExpressionVisitor visitor, MethodCallExpression expression) at Mindscape.LightSpeed.Linq.Plan.LinqQueryBuilder.VisitMethodCall(MethodCallExpression exp) at Mindscape.LightSpeed.Linq.Plan.LinqQueryBuilder.Visit(Expression exp) at Mindscape.LightSpeed.Linq.Sqo.Select.Evaluate(ExpressionVisitor visitor, MethodCallExpression expression) at Mindscape.LightSpeed.Linq.Plan.LinqQueryBuilder.VisitMethodCall(MethodCallExpression exp) at Mindscape.LightSpeed.Linq.Plan.LinqQueryBuilder.Visit(Expression exp) at Mindscape.LightSpeed.Linq.Plan.LinqQueryBuilder.Build(Expression translation, LinqQueryProvider provider) at Mindscape.LightSpeed.Linq.LinqQueryProvider.GetExecutionPlan(Expression expression) at Mindscape.LightSpeed.Linq.LinqQueryProvider.Execute(Expression expression) at Mindscape.LightSpeed.Linq.LinqQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression) at Mindscape.LightSpeed.Linq.LinqQuery`1.GetEnumerator() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at iSupplyRegional.ProductMasterService.GetDistCorpDetails(Int32 productId) in C:\Projects\Regional\Site\iSupplyRegional\ServiceLayer\Services\ProductMasterService.cs:line 265 at iSupplyRegional.Web.DistCorpDetails.LoadData() in C:\Projects\Regional\Site\iSupplyRegional.Web\ProductMaster\DistCorpDetails.aspx.cs:line 62 at iSupplyRegional.Web.DistCorpDetails.Page_Load(Object sender, EventArgs e) in C:\Projects\Regional\Site\iSupplyRegional.Web\ProductMaster\DistCorpDetails.aspx.cs:line 15
Any thoughts on what might be causing the error?