score:1
The error itself is not related to dynamic queries. You can reproduce it like this:
using Microsoft.EntityFrameworkCore;
// ...
IQueryable<string> test = (new[] { "a", "b" }).AsQueryable();
var result = test.Where(c => EF.Functions.Like(c, "a")).ToArray();
This will throw the same exception, and this is kind of query you are dynamically building with expressions in your ContainsFilter
. The reason is EF.Funcions.Like
is not intended to be used with in-memory collections. It's only purpose is to be analyzed by EF Core expression tree analyzer and be converted to SQL LIKE
statement. If you execute this function normally (that's what happens when you use it with in-memory collection) it just throws exception:
EF.Functions.Like("a", "b"); // throws the same exception
So to filter in-memory you need to use something different (maybe just basic string.Contains
will do, maybe not, we don't know).
Source: stackoverflow.com
Related Articles
- Dynamic Expression doesn't support Like
- passing dynamic expression to order by in code first EF repository
- How to create dynamic entity framework filter expression like Expression<Func<T, bool>>
- Like search for datetime fields using dynamic lambda expression
- new to linq. compiler doesnt like my query. Code provided
- The data source does not support server-side data paging
- Like in Lambda Expression and LINQ
- Error: An expression tree may not contain a dynamic operation
- How to use Dynamic LINQ (System.Linq.Dynamic) for LIKE operation?
- How to build a dynamic AND OR linq expression tree in a loop
- Dynamic Expression using LINQ. How To Find the Kitchens?
- Dynamic linq query expression tree for sql IN clause using Entity framework
- How to reuse a linq expression for 'Where' when using multiple source tables
- Dynamic Linq Expression for IEnumerable<int>.contains(MemberExpression)
- "Does Not Contain" dynamic lambda expression
- Like operator in Expression Tree
- How to generate dynamic expression with a bitwise operator and enums?
- How to convert dynamic value to type value in expression
- Compiler Error : An expression tree may not contain a dynamic operation
- Null Reference Exception in a Dynamic LINQ Expression
- Dynamic Lambda Expression call
- Dynamic LINQ Expression for sorting navigation property
- Execute expression on another IQueryable source
- LINQ Source Code Available
- Generate dynamic LINQ expression based on array
- Using the Select method for dynamic queries and expression trees
- .NET 4 Code Contracts: "requires unproven: source != null"
- how to create a pivot table with dynamic column using linq tree expression
- How to create a dynamic 'contains or LIKE' Expression to be used with Linq against OData service
- Dynamic LINQ Like
- How can I merge the results of a group by Linq-to-XML query?
- Put Linq .ToList() to datatable
- LINQ query to sort list of numeric strings with NULLs
- Dynamic where condition in LINQ
- How do I do a LINQ GroupBy where the key can be reversed?
- Use Linq to return first result for each category
- How to use IGrouping enumeration in C#
- Fetch distinct record from dataset/table using linq to dataset/datatable
- how do I make this LINQ query faster?
- Is there an easy way for me to iterate through a collection and create a report?
- Using order by round
- Why can I use If Else syntax and not a ternary operator?
- LINQ - get parent based on last child condition
- flatten deserialized json using linq into "denormalized" list
- Error when trying to "where" on strongly typed list, error CS0103
- Ordinal Position of Element in IENumerable Collection (Linq to XMl )
- Find previous number in string
- Retrieve relational data using linq
- Order table according to the order in another table
- OrderBy in EF linq to entities can't handle the goodness I'm throwing at it.