In the same time it means that 2 objects, for example, one created in the runtime and another retrieved from the database, with the same data (field values) won't be equal for db4o.
There are 2 ways to compare db4o objects by data:
using QBE;
implementing a suitable
equals
method.
Let's save an object to the database and try the above mentioned methods in practice.
01private static void StorePilot() 02
{ 03
IObjectContainer container = Database(); 04
if (container != null) { 05
try { 06
Pilot pilot = new Pilot("Kimi Raikkonnen", 100); 07
container.Set(pilot); 08
} catch (Exception ex) { 09
System.Console.WriteLine("System Exception: " + ex.Message); 10
} finally { 11
CloseDatabase(); 12
} 13
} 14
}
01Private Shared Sub StorePilot() 02
Dim container As IObjectContainer = Database() 03
If container IsNot Nothing Then 04
Try 05
Dim pilot As New Pilot("Kimi Raikkonnen", 100) 06
container.[Set](pilot) 07
Catch ex As Exception 08
System.Console.WriteLine("System Exception: " + ex.Message) 09
Finally 10
CloseDatabase() 11
End Try 12
End If 13
End Sub