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 Query
- 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
More Query from same tag
- Linq to Join tables based on date in between
- Complex DTO and LINQ
- Getting single result from a query with anonymous types in Linq To Sql
- Best practices re: LINQ To SQL for data access
- LINQ to Entities does not recognize the method 'Int32 ToInt32(Boolean)'
- EF Core 3.1 Generated Expressions at Runtime all fail with unable to processes query on server
- JSON.NET use empty string when data is not available
- LINQ-to-object string.Substring not returning results
- Linq query to get all items with an average rating score
- Is this de best way to update an entity from DataContext?
- Calling method with linq syntax based on condition
- Foreach item i in collection of lists
- LINQ to Entities does not recognize the method 'System.String StringConvert(System.Nullable`1[System.Double])
- Challenge: elegantly LINQify this procedural code
- Check if linq object is referenced
- Column doesn't populate with lazy loading turned off
- How to join two tables with Linq in an MVC controller
- Dividing entities into groups
- asp.net mvc many-to-many relationships in linq to sql
- Excuting query: "LINQ to Entitites does not recognize method 'System.Object getItem(System.String)'"
- Linq with critera for nested list
- Group and sum and fetch with condition in Linq
- Linq query stored as string and/or serialized as Json
- Using LINQ to Group, concatenate and Counting
- Entity Framework Core random records from a range in MYSQL
- Invalid Column Name : SQL / ASP.NET
- LINQ: How to Sum over Grouping using method style linq?
- Why does foreach calls GetHashCode?
- Convert Function Based on TSQL with Function Based with Entity Framework
- Split substring from string and count till next character