I'm looking for a way to select using lambda.. something similar to this TSQL
SELECT Id FROM TableA
WHERE TableA.col1 +' '+ TableA.col2 IN
(
SELECT TableB.col1 +' '+ TableB.col2 FROM TableB
)
so far I have this lambda expression:
public async Task<int[]> GetFavouritesIdsAsync()
{
String[] mergedTableB = await _basicContext.TableB.Select(x => $"{x.col1}_{x.col2}").ToArrayAsync(); // this works!
return await _basicContext.TableA.Where(x => mergedTableB.Contains($"{x.col1}_{x.col2}")).Select(x => x.Id).ToArrayAsync();
}
but it doesn't work - EF couldn't translate string.format bla bla....
any workaround?