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

To fix this use a temporary variable:

var tmp = aa[i];
...
m => m.PresId == tmp

In your where clause you have

m => m.PresId == aa[i]

which is a way of expressing a lambda expression. When that is converted to an expression, then converted into a query on your database it finds the aa[i], which is an index into an array. i.e. it doesn’t treat it as a constant. Since a translation of an indexer to your database language is impossible it gives the error.

Leave a Comment