I'm using C# EF Core version 7.
I have a value object called Email which contains a string Value getter property which will hold the email value, and i have entity called Person which have Id and email
i have configuered my entity using fluent api as below:
the Id is the key
and i have added a convertor for Email Value object
Then i made a query to retrive all emails that contains "Alex" as below
var result = _myContext.Person.Where(p => p.Email.Value.Contains("Alex")).ToList();
but it encountered error as below:
The LINQ expression 'DbSet<Person>()
.Where(p => p.Email.Value.Contains("Alex"))' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'.