Question

The application I am working on is client/server with REST communication between them. I want to use db4o on server side. The client can update or create entries. Thus, the object comes back to server from the client for update from "out of the ObjectContainer".

Let:

  public class IdHolder
  {
    public Guid Id {get; set;}
  }

  public class MyClass : IdHolder
  {
    public string SomeData {get; set;}
    public IdHolder Child {get; set;}
  }

As you ca see, the class MyClass has a reference to IdHolder.

According to db4o documentation I have 2 solutions: 1. internal Uuid 2. manual Guid handling

In case 1., the client must have a reference to db4o assembly to be aware of specific type db4o.Uuid which is not good.

In case 2. (which is implicite in the classes definition above) the Guid handling is convinient but db4o is not aware of inner IdHolder reference. For instance:

  • o1 is a IdHolder saved in DB
  • o2 is a MyClass with o2.Child == o1

When o2 is sent to Server for saving, a duplicate entry of o1 is saved in DB because db4o does not know that o1 already exists and can be found by its o1.Id.

The question is: what is the best way to handle disconnected scenarios using db4o?

Edit:

This part if the doc deals with such an issue. "Merging". Does not seem very satisfying to me. I remain open to your conceptual/technical ideas.

Was it helpful?

Solution

There's basically no support for that on the db4o side. The 'merging' like the doc says is basically the best option you've got.

db4o is not very optimal for web apps, because of this. (And it also doesn't scale, since it inherently single threaded.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top