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

the problem not linq itself, because query parsed expression tree entity framework doesn't understand.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -