tags:

views:

232

answers:

2

Does anyone know how how to execute something like a "SELECT TOP n" in DB4O in C#

+1  A: 

This page should be useful to you:
http://developer.db4o.com/forums/thread/55863.aspx

Also if you like it, here's a LINQ implementation for DB4O:
http://www.codeproject.com/KB/database/LINQ_for_db4o.aspx

Zyphrax
+3  A: 

Results of a db4o query are lazy through the use of the facade pattern. You can do a simple for loop from i = 0 to i = n in order to work only with the top n items. The rest are not activated, although they are countable through the facade's Count property.

Travis Heseman
You can also use the ext().config().queryMode() to set the query evaluation to lazy. In this mode, db4o won't even build the full result set. (normal query evaluation finds all result objects, but as you said, does not activate them)
Eric Falsken