使用IQueryable的缺点! [英] disadvantages of using IQueryable !

查看:158
本文介绍了使用IQueryable的缺点!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在与使用IQueryable相关的性能问题?
此外,如果我使用游标而不是使用IQueryable(那更好).
IQueryable vs IEnumerable vs IList吗?
我使用MongoDB作为数据库.谢谢

Is there are any performance issues related to using IQueryable ?
Besides, if I use a cursor instead of using IQueryable (is that better) .
IQueryable vs IEnumerable vs IList ?
I use MongoDB as my database . Thank you

推荐答案

我不知道MongoDB C#绑定的工作原理,但描述它通常如何工作:

I don't know how the MongoDB C# binding works, but describe how it usually works:

使用IQueryable时,将构建一个表达式树,然后将其转换为数据库可以理解的格式,然后在数据库服务器中执行.

When using IQueryable an expression tree is constructed, then translated into a format the database can understand and then executed in the database-server.

与直接以数据库可理解的格式编写查询相比,这通常具有较小的开销(构造表达式树并对其进行翻译).

This typically has a small overhead(construct expression tree and translate it) compared to directly writing queries in the format the database understands.

IEnumerable一起使用委托,而不是表达式.它需要遍历完整的数据集,然后使用Linq-To-Objects进行过滤.这要慢得多.

With IEnumerable delegates are used, instead of expressions. It needs to iterate over the complete dataset and then filters using Linq-To-Objects. This is much slower.

这篇关于使用IQueryable的缺点!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆