I'm not sure if this is possible but I'm using sqlite and dynamic data structure. Essentially the end user can upload csv files of any type.
So I want to be able to dynamically select a column/s and map to a known type e.g.
var selectStatement = $"r => new Foo(double.Parse(r.{column}))";
var whereStatement = $"x => x.{column} != null";
IQueryable view = data.Where(whereStatemnet).Select(selectStatement).AsQueryable();
However at this point I know the result should be IEnumerable but obviously the compiler doesn't.
I only have a very few base classes that would ever needed to be mapped but unfortunately not all are single column however based on the parameter list I would know... e.g 3 string columns is of type Fizz() and 2 columns could be a Buzz()
Am I going about this wrong way?
Thanks