I'm trying stuff with db4o since a few days but I got a problem.
Imagine this class just for test:
class Test
{
public string TestString
public int Number;
public Bitmap Bm;
public Test2 T2;
}
I'm saving the entire class and all sub-objects. But when I load it, I don't want Bm to be loaded (just leave it null). How can I leave it out? I need to save it because in some cases, I need to load it. It's a performance thing because the pictures are really large.
Well, the easiest solution (IMHO) is to wrap the BitMap class in another class and use db4o's transparent activation feature:
Note that even though I have implemented the IActivatable interface manually I don't recommend that; you can use db4otool to implement it for you automatically.
Another possible solution is to control activation for your type (when an object is not activated in db4o, its reference is valid but all of its fields will be not initialized taking no space whatsoever).
For instance you can do something like:
You can also play with activation depth.
Hope this help.