14. Configuration


db4o provides a wide range of configuration methods to request special behaviour. For a complete list of all available methods see the API documentation for the Db4objects.Db4o.Config and Db4objects.Db4o.CS.Config namespaces.  
A more complete description of Configuration usage and scope can also be obtained from the Reference  documentation.

Some hints around using configuration calls:


    14.1. Scope

    Configuration should be created and passed to an opening ObjectContainer or ObjectServer:

    IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

    IServerConfiguration serverConfig = Db4oClientServer.NewServerConfiguration();

    IClientConfiguration clientConfig = Db4oClientServer.NewClientConfiguration();


    Appropriate configuration should be submitted when an IObjectContainer  ObjectServer is opened:

    Db4oEmbedded.OpenFile(config, filename)

    Db4oClientServer.OpenServer(serverConfig, filename, PORT)

    Db4oClientServer.OpenClient(clientConfig, HOST, PORT, USER, PASS);


    A separate configuration instance should be created for each new IObjectContainer  ObjectServer  It is recommended to use a factory method with all the necessary settings.



    14.2. Calling Methods

    Configurations that influence the database file format will have to take place, before a database is created, before the first #OpenXXX() call. Some examples:

    IEmbeddedConfiguration conf = Db4oEmbedded.NewConfiguration();
    conf.BlockSize(8);
    conf.StringEncoding(new MyStringEncoding());


    Configuration settings are not stored in db4o database files. Accordingly the same configuration has to be submitted  every time an  IObjectContainer  ObjectServer  is opened.