Hi Guys. I have a linq question (linq to sql). I have the following peice of code which 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 within the contain method can be decided at runtime. I determine the column name from another query dependent on certain user filters being applied and would ideally like something with the follwing logic;
//please note that the string I pass into obtain a 'column object' always shares 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 been unable to find anything that will allow this and I'm beggining to think that Linq does not allow such logic. Any help would be much appreciated