locked
'NavigationExpandingExpressionVisitor query in ef core 3.1 error RRS feed

  • Question

  • User-323149085 posted

    Hello , i have a query that was working fine in ef core 2.2 but after changing to 3.1 and the changes i cant find the best way (or any way) to write this 

    without getting this Error : 

    InvalidOperationException: Processing of the LINQ expression 'DbSet<QuettaReq>
    .Where(c => c.Category.CatName == __getCategoryWsupId_CatName_0 && c.OfferDate < DateTime.Now)
    .Where(bb => !(__inList_1.Contains(bb.Id)))
    .GroupJoin(
    outer: DbSet<QuoteQuestion>
    .OrderBy(a => a.QuoteId),
    inner: quetta => quetta.Id,
    outerKeySelector: qestion => qestion.QuoteId,
    innerKeySelector: (quetta, joinQestionQuetta) => new ReqestWithQA{
    ReqText = quetta.ReqText,
    Qentity = quetta.Qentity,
    CatId = quetta.CatId,
    CatName = quetta.Category.CatName,
    District = quetta.District,
    ApplicationDate = quetta.ApplicationDate,
    DeliveryDate = quetta.DeliveryDate,
    OfferDate = quetta.OfferDate,
    TecnicalDetails = quetta.TecnicalDetails,
    Bedget = quetta.Bedget,
    Id = quetta.Id,
    QAViewModel = joinQestionQuetta
    .Select(q => new QAViewModel{
    Question = q.Question,
    Answers = q.Answers,
    Id = q.QuoteId,
    QuoteQuestionId = q.QuoteQuestionId
    }
    )
    .ToList()

    the query in my controller : 

    IQueryable<ReqestWithQA> fitReqests =
                        _context.Quetta
                        .Where(c => c.Category.CatName == getCategoryWsupId.CatName
                    && c.OfferDate > DateTime.Now)
                      .Where(bb => !inList.Contains(bb.Id)) 
    
                       .GroupJoin(_context.quoteQuestions.OrderBy(a => a.QuoteId),
                                    quetta => quetta.Id,
                                        qestion => qestion.QuoteId, (quetta, joinQestionQuetta) => new ReqestWithQA
                                        {
                                            ReqText = quetta.ReqText,
                                            Qentity = quetta.Qentity,
                                            CatId = quetta.CatId,
                                            CatName = quetta.Category.CatName,
                                            District = quetta.District,
                                            ApplicationDate = quetta.ApplicationDate,
                                            DeliveryDate = quetta.DeliveryDate,
                                            OfferDate = quetta.OfferDate,
                                            TecnicalDetails = quetta.TecnicalDetails,
                                            Bedget = quetta.Bedget,
                                            Id = quetta.Id,
                                            QAViewModel =
                                                joinQestionQuetta
                                                    .Select(q => new QAViewModel
                                                    {
                                                        Question = q.Question,
                                                        Answers = q.Answers,
                                                        Id = q.QuoteId,
                                                        QuoteQuestionId = q.QuoteQuestionId
                                                    }).ToList()
                                        }) ;

    Thanks 

    Wednesday, January 29, 2020 11:53 AM

Answers