Method 'Boolean Contains..' has no supported translation to SQL

后端 未结 5 1224
盖世英雄少女心
盖世英雄少女心 2020-12-21 21:09

i have this in my query:

var results = (from urls in _context.Urls
               join documents in _context.Documents on urls.UrlId equals documents.Documen         


        
5条回答
  •  南笙
    南笙 (楼主)
    2020-12-21 22:00

    An interesting fact about this is that I get the following error when running in .NET 4.0 on my development machine:

    "Method 'Boolean Contains(Int32)' has no supported translation to SQL."

    But it runs just fine in the production environment that utilizes .NET 3.5.

    I am guessing that it is the difference in versions between the two environments. However, it is a fact that I get the error on my development machine, but the queries DO RUN on the production environment and the LINQ query does contain the following code

    var resultParts = (
                    from l in tempDc.LineItems
                    from wo in tempDc.WorkOrders
                    where l.WorkOrderNumber == wo.WorkOrderNumber &&
                        l.OrderID == wo.OrderID &&
                        workOrderSerialNumbers.Contains(wo.SerialNumber) &&
                        l.Part.PartTypeID == (int)PartTypes.InventoryPart
                    orderby l.OrderID_WO, l.WorkOrderNumber
                    select new PickReportPartDto()
                    {...
    

    Where 'workOrderSerialNumbers is a List.

提交回复
热议问题