使用 NHibernate 3.0 QueryOver 或 LINQ 提供程序的权衡 [英] Tradeoffs using NHibernate 3.0 QueryOver or LINQ provider

查看:28
本文介绍了使用 NHibernate 3.0 QueryOver 或 LINQ 提供程序的权衡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还没有发现 NHibernate 3.0 LINQ Provider 支持的内容与使用 QueryOver 语法的明确比较.从表面上看,这似乎是将两个巨大的努力转化为两个非常相似的东西.

I have not found a clear comparison of what is supported with the NHibernate 3.0 LINQ Provider compared to using the QueryOver syntax. From the surface, it seems like two large efforts into two very similar things.

使用每种方法的关键权衡是什么?

What are the key trade offs to using each?

推荐答案

LINQ 和 QueryOver 是完全不同的查询方法,是在 NHibernate 2 (Criteria, HQL, SQL) 中添加的查询方法

LINQ and QueryOver are completely different query methods, which are added to the ones that existed in NHibernate 2 (Criteria, HQL, SQL)

QueryOver 是 Criteria 的强类型版本,并且支持大部分相同的构造,这些构造是特定于 NHibernate 的.

QueryOver is meant as a strongly-typed version of Criteria, and supports mostly the same constructs, which are NHibernate-specific.

LINQ 是一种标准"查询方法,这意味着客户端代码可以在 IQueryable 上工作,而无需显式引用 NHibernate.它支持一组不同的结构;很难说与 QueryOver 相比是多还是少.

LINQ is a "standard" query method, which means the client code can work on IQueryable without explicit references to NHibernate. It supports a different set of constructs; it would be hard to say if there are more or less than with QueryOver.

我的建议是学习所有支持的查询方法,因为每个用例都是不同的,有些使用一种效果更好,有些使用另一种效果更好.

My suggestion is to learn all the supported query methods, as each use case is different and some work better with one, some work better with other.

这篇关于使用 NHibernate 3.0 QueryOver 或 LINQ 提供程序的权衡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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