1. First Glance

Before diving straight into the first source code samples let's get you familiar with some basics.


    1.1. The db4o engine...

    The db4o object database engine consists of one single DLL. This is all that you need to program against. The version supplied with the distribution can be found in /usr/lib/db4o/.


    1.2. Installation

    To use db4o in a development project, you only need to add one of the above db4o.dll files to your project references.

    Here is how to do this if you are using MonoDevelop:
    - Right-click on "References" in the Solution Tab
    - choose "Edit References"
    - select the ".NET Assembly" tab and then "Browse"
    - select /usr/lib/db4o/db4o.dll
    - click "Open"
    - click "OK"


    1.3. API

    The API documentation for db4o is supplied as a set of HTML pages in
    /usr/share/doc/packages/db4o/api/index.html. While you read through this tutorial, it may be helpful to look into the API documentation occasionaly. For the start, the namespaces com.db4o and com.db4o.query are all that you need to worry about.

    Let's take a first brief look at one of the most important interfaces:

    com.db4o.ObjectContainer

    This will be your view of a db4o database:
    - An ObjectContainer can either be a database in single-user mode or a client to a db4o server.
    - Every ObjectContainer owns one transaction. All work is transactional. When you open an ObjectContainer, you are in a transaction, when you commit() or rollback(), the next transaction is started immediately.
    - Every ObjectContainer maintains it's own references to stored and instantiated objects. In doing so, it manages object identities.

    In case you wonder why you only see very few methods in an ObjectContainer, here is why: The db4o interface is supplied in two steps in two namespaces, com.db4o and com.db4o.ext for the following reasons:
    - It's easier to get started, because the important methods are emphasized.
    - It will be easier for other products to copy the basic db4o interface.
    - We hint how a very-light-version of db4o should look like.

    Every com.db4o.ObjectContainer object also always is a com.db4o.ext.ExtObjectContainer. You can cast to ExtObjectContainer or you can call the #ext() method if you want to use advanced features.



    --
    generated by
    Doctor courtesy of db4objecs Inc.