linq-to-nhibernate

Getting count with NHibernate + Linq + Future

泪湿孤枕 提交于 2019-11-27 12:20:25
问题 I want to do paging with NHibernate when writing a Linq query. It's easy to do something like this: return session.Query<Payment>() .OrderByDescending(payment => payment.Created) .Skip((page - 1)*pageSize) .Take(pageSize) .ToArray(); But with this I don't get any info about the total number of items. And if I just do a simple .Count(), that will generate a new call to the database. I found this answer which solved it by using future. But it uses Criteria. How can I do this with Linq? 回答1: The

Eagerly fetch multiple collection properties (using QueryOver/Linq)?

老子叫甜甜 提交于 2019-11-27 10:46:30
问题 I found 2 similar questions: Multiple Fetches in linq to nhibernate Is this the right way of using ThenFetch() to load multiple collections? According to this page: Be careful not to eagerly fetch multiple collection properties at the same time. Although this statement will work fine: var employees = session.Query<Employee>() .Fetch(e => e.Subordinates) .Fetch(e => e.Orders).ToList(); It executes a Cartesian product query against the database, so the total number of rows returned will be the

Linq to NHibernate [closed]

五迷三道 提交于 2019-11-26 23:57:50
I have been looking around for some example projects or tutorials on Linq to Nhibernate. Does anyone know of any good ones? How about this one: RhinoCommons, NHibernate and ASP.NET MVC Part 1 - Setup And also this quick one: Linq to NHibernate Tutorial 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 And for the

Linq to NHibernate [closed]

笑着哭i 提交于 2019-11-26 09:16:53
问题 I have been looking around for some example projects or tutorials on Linq to Nhibernate. Does anyone know of any good ones? 回答1: How about this one: RhinoCommons, NHibernate and ASP.NET MVC Part 1 - Setup And also this quick one: Linq to NHibernate Tutorial 回答2: 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