簡體   English   中英

Linq to Entities - 使用實體集加入列表

[英]Linq to Entities - JOIN a list with an entity set

我能夠使用listname.Join()方法加入一個實體集的列表(集合)。

例如,

var query = listName.Join(repository.GetQuery<MyCustomType>(),
 list => list.CustomTypeId,
 customType => customType.id,
 (list, customType) => list); 

這工作正常,但它只返回與實體中的列表集合相關的行。 我還想在結果集中使用“MyCustomType”的實例。 我該如何實現這一目標?

var query = listName.Join(repository.GetQuery<MyCustomType>(),
 list => list.CustomTypeId,
 customType => customType.id,
 (list, customType) => new { l = list, c = customType } ); 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM