期待已久的NHibernate.Linq终于发布了正式版

下面是blog上的发布信息:

NHibernate Linq 1.0 released!

The most requested feature for NHibernate for the last few years has been Linq support, and it gives me great pleasure to announce the release of NHibernate Linq 1.0 RTM, which you can download from here.

NHibernate Linq support is based on the existing, proven in production, Linq provider in NHibernate Contrib. The plans to overhaul that and merge that into NHibernate’s proper for the next release are still active, but the project team feels most strongly that production quality Linq support is something that we ought to provide for our users now.

This Linq release support just about anything that you can do with the criteria API. We do not support group joins or subqueries in select clauses, since they aren’t supported by the criteria API. NHibernate’s Linq support has been tested (in production!) for the last couple of years, and most people find it more than sufficient for their needs.

We do plan for expanding the Linq support to support more, but the decision has been made that it makes absolutely no sense not to provide an interim, highly capable, release in the meantime for our users.

Enjoy, and happy linqing.

Oh, and I almost forgot, which would have been a shame. Many thanks for Tuna and Chad, for doing the bulk of the work on the provider.

再附上InfoQ上的相关新闻:

不久之前,NHibernate Forge宣布NHiberante Linq 1.0正式发布了。NHibernate以其灵活的O/R Mapping功能成为了.NET领域最有影响力,运用最广的ORM框架之一,它在某些社区群体的受欢迎程度甚至超过了微软官方的的LINQ to SQL及Entity Framework。作为NHibernate团队的重要成员,NHibernate Profiler项目的创始人Ayende Rahien一直致力于将LINQ这种高效的开发方式与NHibernate强大的功能进行结合。他也在博客中公开了NHibernate Linq 1.0正式发布的消息

过去几年,社区中呼声最高的功能便是Linq支持了,这里我很兴奋地宣布,NHiberante Linq 1.0已经正式发布了。

NHiberante的Linq支持基于NHibernate Contrib中的Linq Provider,它已经通过了一些现有项目的考验。虽然我们还没有确定何时将其合并至NHiberante中,但是项目团队认为现在已经可以给用户提供产品环境质量保证的Linq支持了。

这次的Linq覆盖所有Criteria API的功能。由于Criteria API的功能有限,我们没有提供对group join和子查询的支持。不过NHibernate Linq在过去几年中多次经历了产品环境的测试,大部分人认为可以满足他们的需要。

值得注意的是,这并不是社区中唯一的NHibernate Linq Provider实现。Steve Strong也提供过一个名为LINQ to NHibernate的项目,您可以在NhAddins中获得它的代码。与前者不同的是,LINQ to NHibernate使用了类似于Java Hibernate中基于ANTLR的方法,而NHibernate Linq则将Linq表达式转化为Criteria API。

两套不同的Linq Provider实现也引起了一些评论。有人认为双方应该合作,提示用户哪些功能会产生兼容问题,例如将一些API标记为过期,或者将它们转移到其他命名空间下面。对此,Steve回答道:

我目前还没有改变的打算。我经常对(NHibernate Linq)项目的作者说,基于Criteria API的做法会限制它的功能。我打算实现一个基于AST的Linq Provider,不过这还处于计划过程中。我们会追求一定程度上的兼容,但是我认为,如果要获得一些优势的话,难免会出现破坏性的改变。

您可以在NHibernate项目的文件列表中下载NHibernate Linq组件,也可以通过InfoQ中的专题了解更多有关NHibernate内容。

NHibernate的Linq组件使用也是相当简单的,只需要在NHibernate的基础上加上这个程序集就可以通过扩展方法来调用Linq了,如下:
 

ISession session =  GetSession();
var result
= session.Linq<BlogConfig>().SingleOrDefault(c => c.Name == name);
return result
posted on 2009-07-31 12:38  Leven  阅读(419)  评论(0编辑  收藏  举报
CopyRight 2008, Leven's Blog xhtml | css
Leven的个人Blog