c# - LINQ get collection in anonymous type -


i have following linq statement:

var query =(from item in _itemrepository.findall()             item.id == "20649458"                 singelitem in item.listofchildren                 singelitem.property == "singelitem"                 manyitems in item.listofchildren                 manyitems.property == "many"                 select new                             {                                 item.id,                                 singelitem,                                 manyitems                              }); var result = query.tolist(); 

tasks collection of objects , clause tasks.property == "something" matches several items in collection, when use anonymous type in select, 1 item (the first) of matching results instead of collection of tasks. how can matching tasks in collection?

edit: happends flat objects, (just db result set join statement).

when don't use anonymous type you're dealing entity class lazy loads tasks when access them. if want load tasks results try using include method eager load children. see how construct linq entities query load child objects directly, instead of calling reference property or load()


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -