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

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

问题描述

与使用QueryOver语法相比,我没有发现NHibernate 3.0 LINQ Provider支持的内容的明显比较.从表面上看,似乎需要进行两次很大的努力才能将其变成两个非常相似的事情.

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(标准,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天全站免登陆