c# - Return one-level result list from a join statement in EF -


this question has answer here:

i have following simple join statement:

dim result = (from propertydefinition in econtext.propertydefinitions               join productdef in econtext.productpropertyvalues                 on propertydefinition.propertydefid equals productdef.productpropdefid               productdef.productid = 1               select productdef,                      propertydefinition.propertydefname,                      propertydefinition.propertydefname2,                      propertydefinition.propertydefiisdeleted).list() 

if explicitly included columns under productdef works, , result comes in 1 list, result of productdef coming in separated list:

enter image description here

i need productdef , propertydefinition not in nested lists,

how result in one-shot list without need explicitly include columns of productdef?

i don't think can.

you're getting productdef nested object because that's you're asking when specify productdef 1 of values return: productdef object itself, rather of properties.

what want seems equivalent of sql server's table1.* syntax requesting columns of given table returned, potential returning additional values well. don't think exists in linq.

it's possible work dynamic data types this, it'd simpler list out properties want.

eta: or, create type had properties wanted, , create constructor took productdef , propertydefinition , populated fields constructor parameters. deliver object had properties wanted. more work.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -