I have a linq question (linq to sql). I have the following code that works fine;
var queryx = (from sa in d1.SampleAttributes
where nodeTable.ToList().Distinct().Contains(sa.client_post_code_prefix)
select sa.SampleId).Distinct();
Note: nodeTable is of type IQueryable
However, I would like to change this so that the column name inside the contains method can be resolved at runtime. I am defining a column name from another query depending on the custom filters applied, and ideally would like something with follwing logic;
// note that the row I pass gets the "column object" always has the same name as the column
var columnWhatever = GetColumnName(string colName);
var queryx = (from sa in d1.SampleAttributes
where nodeTable.ToList().Distinct().Contains(sa.client_post_code_prefix)
select sa.SampleId).Distinct();
So far, I have not been able to find anything that will allow this, and I'm starting to think that Linq does not allow such logic. Any help would be greatly appreciated