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

Query for List<string> property could not be translated #1922

Open
AlizerUncaged opened this issue May 17, 2024 · 0 comments
Open

Query for List<string> property could not be translated #1922

AlizerUncaged opened this issue May 17, 2024 · 0 comments

Comments

@AlizerUncaged
Copy link

AlizerUncaged commented May 17, 2024

Steps to reproduce

Have a model with a List<string> property like below

public class RealDeduction
{
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    [Key]
    public string Id { get; set; }

    public List<string>? Branches { get; set; } = new(); // string collection
    
    public bool IsActive { get; set; } = true;
    
    public List<PersonUser> ExcludedUsers { get; set; } = new();
// omitted other properties

then try to query it like so await _appDbContext.RealReductions.Where(x => x.Branches.Contains("Clinic")).ToListAsync()

The issue

ef core not being able to perform search in the string collection
image

Further technical details

MySQL version: 10.6.12-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.04
Operating system: Ubuntu 22.04
Pomelo.EntityFrameworkCore.MySql version: 8.0.2
Microsoft.AspNetCore.App version: 8.0.5

Other details about my project setup:
dotnetRider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant