The method 'Where' cannot follow the method 'Select' or is not supported

后端 未结 3 1439
甜味超标
甜味超标 2020-12-11 22:37

Why am I getting:

The method \'Where\' cannot follow the method \'Select\' or is not supported. Try writing the query in terms of supported methods

3条回答
  •  生来不讨喜
    2020-12-11 23:12

    It's because whatever query provider you are using isn't able to handle this. It's not invalid in the general case; in fact most query providers do support filtering after projecting. Certain query providers simply aren't as robust as others, or they are representing a query model that is less flexible/powerful than the LINQ interface (or both). As a result, LINQ operations that are correct from the C# compiler's point of view might still not be translatable by the query provider, so the best it can do is throw an exception at runtime.

提交回复
热议问题