简体   繁体   English

linq在IQueryable IEnumerable上加入

[英]linq join on IQueryable IEnumerable

What would be the best way to join the IEnumerable list with IQueryable. 用IQueryable联接IEnumerable列表的最佳方法是什么。

I already saw this link which talks about it. 我已经看到了有关此链接的链接。 But I want to know if someone had tried something different. 但是我想知道是否有人尝试了不同的方法。 Which wont hinder on performace as i would have huge dataset. 这不会影响性能,因为我将拥有巨大的数据集。

https://ilmatte.wordpress.com/2013/01/06/entity-framework-joining-in-memory-data-with-dbset/ https://ilmatte.wordpress.com/2013/01/06/entity-framework-joining-in-memory-data-with-dbset/

When you have a large IEnumerable and want to join on a database, and the data is too much to embed in a query using Contains or something like that extension, I would suggest add a table to your database, uploading the IEnumerable into the table, and then doing the join on the database. 如果您有一个较大的IEnumerable并想加入数据库,并且数据太多而无法使用Contains或类似扩展名的查询嵌入到查询中,则建议将一个表添加到您的数据库中,然后将IEnumerable上载到该表中,然后在数据库上进行联接。

But if the IEnumerable is much larger than the IQueryable , just filter the IQueryable as much as possible on the database side and then use AsEnumerable to pull it into memory and join there. 但是,如果IEnumerableIQueryable大得多,只需在数据库侧尽可能多地过滤IQueryable ,然后使用AsEnumerable将其拉入内存并在那里进行连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM