Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8741425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:18:48+00:00 2026-06-13T11:18:48+00:00

we are using Db4o in our project. I have some automatic tests where is

  • 0

we are using Db4o in our project.

I have some automatic tests where is tested persistence of objects.
The problem is, I can’t open/create the database twice.
I have two helper methods for geting the object container. But when the method is called second time the “ArgumentException: Configuration already used.” is thrown. I closed and disposed the previous objectcontainer ofcourse.

What I do wrong?

CODE:

public static IObjectContainer GetEmptyTestingDatabase() {
    var tempDir = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
    string dbFilePath = Path.Combine(tempDir, "UNIT-TESTING.db4o");
    if (File.Exists(dbFilePath)) {
        File.Delete(dbFilePath);
    }

    var cfg = Db4oFactory.Configure();
    cfg.Add(new TransparentPersistenceSupport(new DeactivatingRollbackStrategy()));
    cfg.Add(new TransparentActivationSupport());

    var db = Db4oFactory.OpenFile(cfg, dbFilePath);
    return db;
}
public static IObjectContainer GetMemoryDatabase() {
    string dbFileName = Guid.NewGuid().ToString().ToString();

    var cfg = Db4oFactory.Configure();
    cfg.Storage = new Db4objects.Db4o.IO.PagingMemoryStorage();
    cfg.Add(new TransparentPersistenceSupport(new DeactivatingRollbackStrategy()));
    cfg.Add(new TransparentActivationSupport());

    var db = Db4oFactory.OpenFile(cfg, dbFileName);
    return db;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:18:49+00:00Added an answer on June 13, 2026 at 11:18 am

    You are using deprecated db4o methods. The problem is that Db4oFactory.Configure() returns a static config object; this method is there only for backward compatibility.

    If you are using a newer db4o version use Db4oEmbedded.NewConfiguration() instead. Otherwise (if you really need to stick to an older db4o version) using Db4oFactory.NewConfiguration() should also work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Maven project and added db4o as a dependency using this answer
Im working on integrating db4o into my project and I have some questions. I
I am a new to db4o. I have a big problem with persistance of
Does anyone already used db4o OO database manager in a mobile project using Xamarin
I'm using db4o in a small project that works great on Android 2.2, 2.3,
is it possible in Db4o to load new objects into persistent IObjectContainer? I have
I can see how I can instantiate objects of classes using autofac, and then
i'm using db4o with objects: public Tra(String x, int y, int z, int pos,
I am using db4o 8.0. I have a class PostedMessage{ @Indexed long receivedTime; @Indexed
I am using DB4O to store my objects. Please find below code to retrieve

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.