This topic gives you an overview of the most important and basic operations of db4o. First add db4o to your project. db4o doesn't need a complex setup. It's just a library which you can add to your project. See "Getting Started"
The basic operations are, not surprising, storing, updating, querying and deleting objects. See "The Basic Operations"
using(IObjectContainer container = Db4oEmbedded.OpenFile("databaseFile.db4o")) { // store a new pilot Pilot pilot = new Pilot("Joe"); container.Store(pilot); // query for pilots var pilots = from Pilot p in container where p.Name.StartsWith("Jo") select p; // update pilot Pilot toUpdate = pilots.First(); toUpdate.Name = "New Name"; container.Store(toUpdate); // delete pilot container.Delete(toUpdate); }
Using container As IObjectContainer = Db4oEmbedded.OpenFile("databaseFile.db4o") ' store a new pilot Dim pilot As New Pilot("Joe") container.Store(pilot) ' query for pilots Dim pilots = From p As Pilot In container Where p.Name.StartsWith("Jo") ' update pilot Dim toUpdate As Pilot = pilots.First() toUpdate.Name = "New Name" container.Store(toUpdate) ' delete pilot container.Delete(toUpdate) End Using
For more information about queries: See "Querying"
There are some basic concepts which are used in db4o. Understanding them helps to understand how db4o behaves. Some behaviors are common behaviors which you expect from a database, like transactions and ACID properties. See "ACID Properties And Transactions"
db4o manages objects by identity. This means db4o doesn't need additional id-field on your object. See "Identity Concept"
Other concepts are more unique to db4o. For example the activation concept, which controls which objects are loaded from the storage to memory. See "Activation Concept". The same principals are also applied when updating (See "Update Concept" ) or deletion objects (See "Delete Behavior"