I have a string parameter that's split up into multiple search filters depending on the outcome of a Split(',')
operation. I want to select all entities where the title field contains any of the search filters
I'd expect the following LINQ to work
string[] filters = param.Split(',');
var query = await
(from t in this.Context.Persons
from f in filters.Where(f => t.Title.Contains(f))
select t).ToListAsync();
However exequting the query I'm getting the following error:
Processing of the LINQ expression 't => __filters_0
.Where(f => t.Title.Contains(f))' by 'NavigationExpandingExpressionVisitor' failed. This may indicate either a bug or a limitation in EF Core.
Any assistance is appreciated.
I ended up implementing a generic LikeAny extension method on IQueryable as described here: https://github.com/dotnet/efcore/issues/10834
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.