Of course, db4o supports .NET LINQ to query the database.
First, you need to add the Db4objects.Db4o.Linq.dll-assembly to your project. This assembly contains db4o LINQ-Implementation. Make also sure that Mono.Reflection.dll is aside it. See "Dependency Overview"
Note that LINQ requires .NET 3.5 or newer!
Writing a query is simple. You write the LINQ query against the object-container. First you need to import the LINQ-namespaces.
using System.Linq; using Db4objects.Db4o.Linq;
Imports System.Linq Imports Db4objects.Db4o.Linq
After that, you can start to write a LINQ-Query against the object container.
var allPersons = from Person p in container select p;
Dim allPersons = From p In container _ Select p
In order to learn LINQ, take a look a the LINQ-resources and tutorial out on the Internet. For example the LINQ-Overview at MSDNor at this example-collection.
There are also a few simple LINQ query examples for db4o here.
db4o also support the .NET IQueryable interface. This is useful when you want to build an abstraction layer for db4o or integrate db4o with other frameworks.
IQueryable<Person> personQuerable = container.AsQueryable<Person>(); var adults = from p in personQuerable where p.Age > 18 orderby p.Name select p;
Dim personQuerable As IQueryable(Of Person) = container.AsQueryable(Of Person)() Dim adults = From p In personQuerable _ Where p.Age > 18 _ Order By p.Name _ Select p
db4o LINQ provider translates the LINQ queries into db4o's low level query API. Read what this query optimization need and what its limits are. See "LINQ Optimization"
Also read how LINQ is supported on the .NET Compact Framework. See "LINQ For Compact Framework"