не могу соединиться с viewmodel, используя ef core 3.1 - PullRequest
0 голосов
/ 29 января 2020

У меня есть запрос, который работал нормально в ef core 2.2, пытаясь перейти к версии 3.1, и изменение запроса выдает мне следующую ошибку: «NavigationExpandingExpressionVisitor»

в обеих версиях: code: (это было работает нормально в 2.2

 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()
                                });

это то, что я пробовал в 3.1 и получаю ту же ошибку MSG

IQueryable<ReqestWithQA> MyQ = from qu in _context.Quetta
                          join offers in _context.QuettaOffers on qu.Id equals offers.QuettaReqId into quoffers
                          join qa in _context.quoteQuestions on qu.Id equals qa.QuoteId into reqOffersQuestions
                          join the in _context.answers on qu.Id equals the.QuoteId into reqOffersQuAnswer
                          select new ReqestWithQA
                          {
                              ReqText = qu.ReqText,
                              Qentity = qu.Qentity,
                              CatId = qu.CatId,
                              CatName = qu.Category.CatName,
                              District = qu.District,
                              ApplicationDate = qu.ApplicationDate,
                              DeliveryDate = qu.DeliveryDate,
                              OfferDate = qu.OfferDate,
                              TecnicalDetails = qu.TecnicalDetails,
                              Bedget = qu.Bedget,
                              Id = qu.Id,

                              QAViewModel = reqOffersQuestions
                                               .Select(q => new QAViewModel
                                               {
                                                   Question = q.Question,
                                                   Answers = q.Answers,
                                                   Id = q.QuoteId,
                                                   QuoteQuestionId = q.QuoteQuestionId
                                               }).ToList()
                          };
...