<< back to blog

Returning IQueryable rather than List

nhibernate ~ .net ~ linq

20 Oct, 2008

Usually when I write repositories, I end up with code like this:

IList<Order> orders = repos.FindOrdersByStatus(OrderStatus.Packed);

One problem with this is that orders might contain 10,000 records, and I don’t really want to pull all that back from the database in one go. What I think I want is this:

IList<Orders> orders = repos.FindOrdersByStatus(OrderStatus.Packed)
                                                  .Skip10)
                                                  .Take(10)
                                                  .ToList();
FindOrderByStatus

Is anyone doing this?

You may also like...
.NET Gem Fun
Automating .NET development (and NHibernate) with IronRuby + Rake
Get a Rails-Stylee Interactive Shell For Your NHibernate Backed Domain Model
In Memory SQLite Testing with NHibernate
NHibernate Trick
NHibernate: Calling Update Unnecessarily
.NET Config for Multiple Developers
NHibernate in Action 2nd Edition - Your Opinion
Shorthand Repository Accessors
NHibernate for Ruby?

kick it on DotNetKicks.com
blog comments powered by Disqus