Method is not recognized within select

Asked

Viewed 65 times

0

The query works perfectly, but when I include the Getqtdecpossible method that returns an integer, to get the possible amount and not need to make other error queries. What I do wrong?

 var fpcpAdd = (from fpp in contexto.FPP
                join fpc in contexto.FPC on fpp.fpId equals fpc.fpId
                join fpcp in contexto.FPCP on new { fpp.fppId, fpc.ecId }
                      equals new { fpcp.fppId, fpcp.ecId } into x
                               from d in x.DefaultIfEmpty()
                where (fpp.fpId == fpId &&
                       fpIds.Contains(fpp.fpId) &&
                       etIds.Contains(fpp.etId)) &&
                       ecIds.Contains(fpc.ecId) &&
                       d == null
                select new { fpp.fppId,
                             fpc.ecId, 
                             Qtdpossible = GetQtdecPossible(fpp.fppId)
                               }).Distinct().ToList();

LINQ to Entities does not recognize the method 'Int32 Getqtdecpossible(System.Decimal)' method, and this method cannot be Translated into a store Expression.

  • 3

    It is not because in performing the query Linus tries to transform this into a query, and in theory its method is not a query, but a code c#, you know? alternative: restructure your query

  • Thank you very much!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.