entity framework - Using reflection to obtain select fields in a linq query -
i using linq queries , able list of properties want returned in "select" portion using reflection. i've tried following no avail:
string[] paramlist = new[]{"appid","name"}; var query = entity in _ctx.app select new {entity.gettype().getproperties().where(prop=>paramlist.contains(prop.name) )};
what missing here?
when working reflection inside ef query need write expression yourself. @ these existing question more information
- help linq , generics. using getvalue inside query
- how reflect on t build expression tree query?
- iqueryable<> dynamic ordering/filtering getvalue fails
the problem not linq itself, because query parsed expression tree entity framework doesn't understand.
Comments
Post a Comment