Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to evaluate in server if a the property of a row starts with any item of a list of strings? #28292

Closed
ComptonAlvaro opened this issue Jun 22, 2022 · 1 comment

Comments

@ComptonAlvaro
Copy link

ComptonAlvaro commented Jun 22, 2022

Include provider and version information

EF Core version: 6.0.4
Database provider: Microsoft.EntityFrameworkCore.SqlIte
Target framework: NET 6.0
Operating system: Windows 11 21H2
IDE: (e.g. Visual Studio 2022 17.2.3)

I have a list of strings and I would like to get all the entities which one property starts with any of the items of the list.

I am trying this query:

List<string> miLstStrings;   // it is populated with some strings.

List<Data> miLstResultDb = await miDbContext.Data
    .Where(x => miLstStrings.Any(y => x.StringProperty.Contains(y)))
    .ToListAsync()
    .ConfigureAwait(false);

But I get an exception that tells that the query can't be translated to be evaluated in the server. I have to evaluate it in the client using for example, AsAsyncEnumerable.

But I would like to know if it is some way with Entity core to evalute the query in the server.

Thanks.

@ajcvickers
Copy link
Member

ajcvickers commented Jun 29, 2022

Duplicate of #19070

@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Jun 29, 2022
@ajcvickers ajcvickers marked this as a duplicate of #19070 Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants