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).


Related Articles