I have an array of in memory objects that represent the composite keys that I want to query by eg:
public class Key
{
public string Part1 {get;set;}
public string Part2 {get;set;}
}
Now say I have an IQueryable<Table1> and I want to return all the records with the above Keys. Table1 does not have a surrogate key, it has a composite key made up of 2 columns. I also want to avoid per row retrieval.
How can I do this? I tried standard join, but for obvious reasons my ORM is confused when in memory objects is thrown in the mix.
A workaround could to to work with concatenation
something like that.
The separator (
~in this case) is arbitrary, meant to be a char that won't be found in your strings.It 's there to avoid "wrong" matches (12 and 3 vs 1 and 23, for example)