db4o supports embedded containers or session container. It's a separate object-container with its own transaction and own reference cache. See "Session Containers"
Now if you're using the client-server mode for db4o, you also can create such sessions directly from the server. When you pass a 0 to the open server method, the server only supports embedded clients. With any other port you can connect with regular clients and also create embedded clients.
using (IObjectServer server = Db4oClientServer.OpenServer(DatabaseFileName, 0)) { // open the db4o-embedded client. For example at the beginning for a web-request using (IObjectContainer container = server.OpenClient()) { // do the operations on the session-container container.Store(new Person("Joe")); } }
Using server As IObjectServer = Db4oClientServer.OpenServer(DatabaseFileName, 0) ' open the db4o-embedded client. For example at the beginning for a web-request Using container As IObjectContainer = server.OpenClient() ' do the operations on the session-container container.Store(New Person("Joe")) End Using End Using
You might noted that the open-session is available on any object-container. Normally this creates a session-container with its own transaction and reference cache. However on a db4o-client this is not true. There it only creates a container with new cache, but shares the transaction with the client. The only use case for this is to implement connection pooling.See "Client-Container Pooling"