await this.dbContext
.UserTeams
.Where(ut =>
teamMembers.Any(tm => tm.UserId == ut.UserId
&& ut.TeamId == tm.TeamId))
.ToListAsync();
here teamMember is a simple list that contains grouped UserIds
and TeamIds
. This works if i use Contains()
but UserId
and TeamId
is a composite key here.
This is a fairly simple query and cannot be translated.
Error:
System.InvalidOperationException: The LINQ expression 'DbSet<UserTeam>
.Where(u => __teamMembers_0
.Any(tm => u.TeamId == tm.TeamId && u.UserId == tm.UserId))'
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()