.net Linq 到 NHibernate

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/624609/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 12:17:21  来源:igfitidea点击:

Linq to NHibernate

.netlinqnhibernatelinq-to-nhibernate

提问by Ted Smith

I have been looking around for some example projects or tutorials on Linq to Nhibernate.

我一直在寻找一些关于 Linq to Nhibernate 的示例项目或教程。

Does anyone know of any good ones?

有谁知道有什么好的吗?

回答by alexl

If you need the best samples on a project. You can look at the tests. You will have the most complete samples for every fields. (Only if the project is unit tested :))

如果您需要项目中的最佳样本。你可以看看测试。您将拥有每个领域最完整的样本。(仅当项目经过单元测试时:))

look here for select samples: http://nhcontrib.svn.sourceforge.net/viewvc/nhcontrib/trunk/src/NHibernate.Linq/src/NHibernate.Linq.Tests/SelectionTests.cs?view=markup

在此处查看精选示例:http: //nhcontrib.svn.sourceforge.net/viewvc/nhcontrib/trunk/src/NHibernate.Linq/src/NHibernate.Linq.Tests/SelectionTests.cs?view=markup

And for the all test folder: http://nhcontrib.svn.sourceforge.net/viewvc/nhcontrib/trunk/src/NHibernate.Linq/src/NHibernate.Linq.Tests/

对于所有测试文件夹:http: //nhcontrib.svn.sourceforge.net/viewvc/nhcontrib/trunk/src/NHibernate.Linq/src/NHibernate.Linq.Tests/

Hope this helps.

希望这可以帮助。

回答by Marc Climent

Linq to NHibernate has not many differences from any other Linq provider, apart from not being complete or fully tested and stable.

Linq to NHibernate 与任何其他 Linq 提供程序没有太大区别,除了不完整或不完全测试和稳定之外。

When you import NHibernate.Linq you get an extension method .Linq() that returns a IQueryable that can be used like any other Linq collection, so from here, any good Linq tutorial or explanation can help you.

当您导入 NHibernate.Linq 时,您会得到一个扩展方法 .Linq(),它返回一个 IQueryable,可以像任何其他 Linq 集合一样使用,因此从这里开始,任何好的 Linq 教程或解释都可以帮助您。

The most interesting thing that you get with Linq to NHibernate IMHO is deferred execution. That is that the database is hit when you really need the results.

使用 Linq to NHibernate 恕我直言,最有趣的事情是延迟执行。也就是说,当您真正需要结果时,数据库就会被命中。

Hope this helps.

希望这可以帮助。

回答by Frans Bouma

There's currently not a mature linq to nhibernate provider, so you've to wait till that's implemented I think before you can do anything beyond from x in .. where .. select...

目前还没有成熟的 linq 到 nhibernate 提供程序,所以你必须等到它实现我认为你才能做任何超出 x in .. where .. select ...

回答by Ben

Here is one I have found. It talks about a few more technologies other than LINQ to NHibernate. But I still find it good. LINQ to NHibernate

这是我找到的一个。它讨论了除 LINQ to NHibernate 之外的其他一些技术。但是我还是觉得挺好的。 LINQ 到 NHibernate