Problem
I am attempting to query a table (based on ModelA) using another table (based on ModelB). These models are simplified for this example. I need to keep the result as an IQueryable, so changing to an Enumerable or List are not options. Still, I tried adding .ToList() but got the same error.
Pulling the MyIds out of one list into a list of strings (in order to use Contains()) isn't an option since there may be too many MyIds (> 40k) that causes an error indicating the operation as run out of resources, which I would guess refers to RAM.
Error
InvalidOperationException: The LINQ expression ... 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 either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync().
ModelA
public class ModelA
{
    public string MyId { get; set; }
    public string MyName { get; set; }
}
ModelB
public class ModelB
{
    public string MyId { get; set; }
    public string MyName { get; set; }
}
Attempt
var results = context.ModelA
            .Where(a => ModelB.All(b => b.MyId == a.MyId));
What way(s) can this be done successfully?
 
     
     
     
    