The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities

后端 未结 6 1640
离开以前
离开以前 2020-11-30 08:16
public List GetpathsById(List id)
{
    long[] aa = id.ToArray();
        long x;
    List paths = new List();
         


        
6条回答
  •  心在旅途
    2020-11-30 09:01

    Apparently, if you use an array index (aa[i]) inside an expression tree, it tries to convert that into an expression as well.

    Just work around it by using a separate variable:

    int presId = aa[i];
    Presentation press = context.Presentations.Where(m => m.PresId == presId).FirstOrDefault();
    

提交回复
热议问题